hyprland-wiki/pages/Configuring/Expanding-functionality.md
Mihai Fufezan 127ae00225 wiki: prepare for hextra
treewide: replace hint with callout

treewide: remove ToC header

remove <toc>, since it's autogenerated
add missing _index.md

treewide: add frontmatter

treewide: fix headings

add weights

Configuring,Getting Started: expand in sidebar

Add version selector

fix links
2024-03-14 22:47:27 +02:00

33 lines
851 B
Markdown

---
weight: 13
title: Expanding functionality
---
Hyprland exposes two powerful sockets for you to use.
The first, socket1, can be fully controlled with `hyprctl`, see its usage
[here](../using-hyprctl).
The second, socket2, sends events for certain changes / actions and can be used
to react to different events. See its description [here](../../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
#!/usr/bin/env bash
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/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | while read -r line; do handle "$line"; done
```