Global hotkeys and binds
Global Keybinds
Classic
Yes, you heard that right, Hyprland does support global keybinds for ALL apps, including OBS, Discord, Firefox, etc.
See the pass and send_shortcut dispatchers for keybinds.
Let’s take OBS as an example: the “Start/Stop Recording” keybind is set to SUPER + F10, to make it work globally, simply add:
hl.bind("SUPER + F10", hl.dsp.pass({ window = [[class:com\.obsproject\.Studio]] }))pass will pass the PRESS and RELEASE events by itself, no need for a release flag.
This also means that push-to-talk will work flawlessly with one pass, e.g.:
-- Pass MOUSE5 to TeamSpeak 3
hl.bind("mouse:276", hl.dsp.pass({ window = "class:TeamSpeak 3" }))You may also add shortcuts, where other keys are passed to the window.
-- Send SUPER + F4 to OBS when SUPER + F10 is pressed.
hl.bind("SUPER + F10", hl.dsp.send_shortcut({ mods = "SUPER", key = "F4", window = "class:(TeamSpeak 3)" }))Warning
This works flawlessly with all native Wayland applications. However, Xwayland is a bit wonky. Make sure that what you’re passing is a “global Xorg keybind”, otherwise passing from a different Xwayland app may not work.
D-Bus global shortcuts
Note
This function will only work with XDPH.
Some applications may already support the GlobalShortcuts portal in xdg-desktop-portal.
If that’s the case, it’s recommended to use the following method instead of pass:
Open your desired app and run hyprctl globalshortcuts in a terminal.
This will give you a list of currently registered shortcuts with their descriptions.
Choose whichever you like, for example coolApp:myToggle, and bind it to whatever you want with the global dispatcher:
hl.bind("SUPER + SHIFT + A", hl.dsp.global("coolApp:myToggle"))The global shortcuts protocol can send both “activated” and “deactivated” events.
By default, the global dispatcher sends events based on the key input that triggered it.
For example, if used in a release bind, it will only send “deactivated” events, which your app may not respond to.
To override this and send a specific event, pass a boolean second argument to global (true/false for an activated/deactivated event, respectively).