Added sendshortcut dispatcher (#661)

This commit is contained in:
Can 2024-05-24 20:59:09 +02:00 committed by GitHub
parent 9be12ba01f
commit bffd31319f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View file

@ -248,7 +248,7 @@ bindr=ALT,Alt_L,exec,amongus
Yes, you heard this right, Hyprland does support global keybinds for ALL apps,
including OBS, Discord, Firefox, etc.
See the [`pass` dispatcher](../Dispatchers/#list-of-dispatchers) for keybinds.
See the [`pass` dispatcher](../Dispatchers/#list-of-dispatchers) and the [`sendshortcut` dispatcher](../Dispatchers/#list-of-dispatchers) for keybinds.
Let's take OBS as an example: the "Start/Stop Recording" keybind is set to
<key>SUPER</key> + <key>F10</key>, and you want to make it work globally.
@ -270,6 +270,14 @@ bind=,mouse:276,pass,^(TeamSpeak 3)$
Will pass MOUSE5 to TeamSpeak3.
You may also add shortcuts, where other keys are passed to the window.
```ini
bind = SUPER,F10,sendshortcut,SUPER,F4,^(com\.obsproject\.Studio)$
```
Will send <key>SUPER</key> + <key>F4</key> to OBS if you press <key>SUPER</key> + <key>F10</key>.
{{< callout >}}
This works flawlessly with all native Wayland applications. However, XWayland is a bit wonky.

View file

@ -17,6 +17,8 @@ layout pages (See the sidebar).
| resizeparams | relative pixel delta vec2 (e.g. `10 -10`), optionally a percentage of the window size (e.g. `20 25%`) or `exact` followed by an exact vec2 (e.g. `exact 1280 720`), optionally a percentage of the screen size (e.g. `exact 50% 50%`) |
| floatvalue | a relative float delta (e.g `-0.2` or `+0.2`) or `exact` followed by a the exact float value (e.g. `exact 0.5`) |
| zheight | `top` or `bottom` |
| mod | `SUPER`, `SUPER_ALT`, etc. |
| key | `g`, `code:42`, `42` or mouse clicks (`mouse:272`) |
## List of Dispatchers
@ -25,6 +27,7 @@ layout pages (See the sidebar).
| exec | executes a shell command | command (supports rules, see [below]({{< relref "#executing-with-rules" >}})) |
| execr | executes a raw shell command (does not support rules) | command |
| pass | passes the key (with mods) to a specified window. Can be used as a workaround to global keybinds not working on Wayland. | window |
| sendshortcut | sends specified keys (with mods) to an optionally specified window. Can be used like pass | mod, key[, window] |
| killactive | closes (not kills) the active window | none |
| closewindow | closes a specified window | window |
| workspace | changes the workspace | workspace |