aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/input-manager.c
diff options
context:
space:
mode:
authorLibravatar Michael Weiser <michael.weiser@gmx.de>2020-02-16 00:40:18 +0100
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2020-03-11 23:51:37 -0400
commit3ee5aace33f1b5673ab372afba38480338ba8b90 (patch)
treea91724f17a916a6075c71f555968fa046973fddd /sway/input/input-manager.c
parentinput: Add support for keyboard shortcuts inhibit (diff)
downloadsway-3ee5aace33f1b5673ab372afba38480338ba8b90.tar.gz
sway-3ee5aace33f1b5673ab372afba38480338ba8b90.tar.zst
sway-3ee5aace33f1b5673ab372afba38480338ba8b90.zip
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/input-manager.c')
-rw-r--r--sway/input/input-manager.c20
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(
333 struct sway_seat *seat = inhibitor->seat->data; 333 struct sway_seat *seat = inhibitor->seat->data;
334 wl_list_insert(&seat->keyboard_shortcuts_inhibitors, &sway_inhibitor->link); 334 wl_list_insert(&seat->keyboard_shortcuts_inhibitors, &sway_inhibitor->link);
335 335
336 struct seat_config *config = seat_get_config(seat);
337 if (!config) {
338 config = seat_get_config_by_name("*");
339 }
340
341 if (config && config->shortcuts_inhibit == SHORTCUTS_INHIBIT_DISABLE) {
342 /**
343 * Here we deny to honour the inhibitor by never sending the
344 * activate signal. We can not, however, destroy the inhibitor
345 * because the protocol doesn't allow for it. So it will linger
346 * until the client removes it im- or explicitly. But at least
347 * it can only be one inhibitor per surface and seat at a time.
348 *
349 * We also want to allow the user to activate the inhibitor
350 * manually later which is why we do this check here where the
351 * inhibitor is already attached to its seat and ready for use.
352 */
353 return;
354 }
355
336 wlr_keyboard_shortcuts_inhibitor_v1_activate(inhibitor); 356 wlr_keyboard_shortcuts_inhibitor_v1_activate(inhibitor);
337} 357}
338 358