From bffd31319f2821b660bd5ec4cbe575247c416dd3 Mon Sep 17 00:00:00 2001
From: Can <45462997+yungcxn@users.noreply.github.com>
Date: Fri, 24 May 2024 20:59:09 +0200
Subject: [PATCH] Added sendshortcut dispatcher (#661)
---
pages/Configuring/Binds.md | 10 +++++++++-
pages/Configuring/Dispatchers.md | 3 +++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/pages/Configuring/Binds.md b/pages/Configuring/Binds.md
index fd940bf..82a951e 100644
--- a/pages/Configuring/Binds.md
+++ b/pages/Configuring/Binds.md
@@ -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
SUPER + F10, 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 SUPER + F4 to OBS if you press SUPER + F10.
+
{{< callout >}}
This works flawlessly with all native Wayland applications. However, XWayland is a bit wonky.
diff --git a/pages/Configuring/Dispatchers.md b/pages/Configuring/Dispatchers.md
index 82c12ec..bfeb023 100644
--- a/pages/Configuring/Dispatchers.md
+++ b/pages/Configuring/Dispatchers.md
@@ -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 |