From 3ee5aace33f1b5673ab372afba38480338ba8b90 Mon Sep 17 00:00:00 2001 From: Michael Weiser Date: Sun, 16 Feb 2020 00:40:18 +0100 Subject: 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 --- sway/input/input-manager.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'sway/input/input-manager.c') 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); } -- cgit v1.2.3