Class ShortcutsInhibitor
An app's request for the keys that would otherwise be the compositor's shortcuts, from the shortcuts_inhibit_request request. Remote desktop viewers and virtual machines ask for it so Super and the like reach the system inside them.
- Nothing is granted until a handler calls
activate. - While any inhibitor on a seat is active, every key event from that seat has
shortcuts_inhibitedset, whichever window is focused. Key handlers still run and check it.
To grant it only while its window has focus, follow the window's focus event:
lua
wm.input:on("shortcuts_inhibit_request", function(inhibitor)
local requesting_window = inhibitor:window()
if not requesting_window then return end
requesting_window:on("focus", function(_, focused)
if focused then inhibitor:activate() else inhibitor:deactivate() end
end)
if #requesting_window.focused_seats > 0 then inhibitor:activate() end
end)Methods
inhibitor:activate() -> nilactivate
Grants it and tells the app. Key events start reporting shortcuts_inhibited.
inhibitor:deactivate() -> nildeactivate
Takes it back and tells the app. It can be activated again.
inhibitor:is_active() -> booleanis_active
Whether it is granted right now.
inhibitor:window() -> Window?window
The window that asked.
- nil when the surface isn't a window's, for example a layer.