diff options
author | Michael Weiser <michael.weiser@gmx.de> | 2020-02-16 00:40:18 +0100 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2020-03-11 23:51:37 -0400 |
commit | 3ee5aace33f1b5673ab372afba38480338ba8b90 (patch) | |
tree | a91724f17a916a6075c71f555968fa046973fddd /sway/input | |
parent | eeac0aa170d4ee19111df072ea361b56c802cf34 (diff) | |
download | sway-3ee5aace33f1b5673ab372afba38480338ba8b90.tar.xz |
commands: Add shortcuts_inhibitor command
Add a command to influence keyboard shortcuts inhibitors. In its current
form it can be used to activate, deactivate or toggle an existing
inhibitor on the surface currently receiving input. This can be used to
define an escape shortcut such as:
bindsym --inhibited $mod+Escape seat - shortcuts_inhibitor deactivate
It also allows the user to configure a per-seat default of whether
keyboard inhibitors are honoured by default (the default) or not. Using
the activate/toggle command they can then enable the lingering inhibitor
at a later time of their choosing.
As a side effect this allows to specifically address a named seat for
actions as well, whatever use-case that might serve.
Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/input-manager.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index af0f5afa..124d57dc 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c @@ -333,6 +333,26 @@ static void handle_keyboard_shortcuts_inhibit_new_inhibitor( struct sway_seat *seat = inhibitor->seat->data; wl_list_insert(&seat->keyboard_shortcuts_inhibitors, &sway_inhibitor->link); + struct seat_config *config = seat_get_config(seat); + if (!config) { + config = seat_get_config_by_name("*"); + } + + if (config && config->shortcuts_inhibit == SHORTCUTS_INHIBIT_DISABLE) { + /** + * Here we deny to honour the inhibitor by never sending the + * activate signal. We can not, however, destroy the inhibitor + * because the protocol doesn't allow for it. So it will linger + * until the client removes it im- or explicitly. But at least + * it can only be one inhibitor per surface and seat at a time. + * + * We also want to allow the user to activate the inhibitor + * manually later which is why we do this check here where the + * inhibitor is already attached to its seat and ready for use. + */ + return; + } + wlr_keyboard_shortcuts_inhibitor_v1_activate(inhibitor); } |