mirror of
https://github.com/hyprwm/hyprland-wiki.git
synced 2024-11-17 02:25:58 +01:00
26 lines
861 B
Markdown
26 lines
861 B
Markdown
|
|
||
|
Hyprland exposes two powerful sockets for you to use.
|
||
|
|
||
|
The first, socket1, can be fully controlled with `hyprctl`, see its usage [here](https://github.com/hyprwm/Hyprland/wiki/Using-hyprctl).
|
||
|
|
||
|
The second, socket2, sends events for certain changes / actions and can be used to react to different events. See its description [here](https://github.com/hyprwm/Hyprland/wiki/IPC).
|
||
|
|
||
|
## Example script
|
||
|
|
||
|
This bash script will change the outer gaps to 20 if the currently focused monitor is DP-1, and 30 otherwise.
|
||
|
|
||
|
```bash
|
||
|
#!/bin/sh
|
||
|
|
||
|
function handle {
|
||
|
if [[ ${1:0:10} == "focusedmon" ]]; then
|
||
|
if [[ ${1:12:4} == "DP-1" ]]; then
|
||
|
hyprctl keyword general:gaps_out 20
|
||
|
else
|
||
|
hyprctl keyword general:gaps_out 30
|
||
|
fi
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
socat - UNIX-CONNECT:/tmp/hypr/$(echo $HYPRLAND_INSTANCE_SIGNATURE)/.socket2.sock | while read line; do handle $line; done
|
||
|
```
|