summaryrefslogtreecommitdiff
path: root/sway/input/input-manager.c
diff options
context:
space:
mode:
authorMichael Weiser <[email protected]>2020-03-12 22:10:04 +0100
committerBrian Ashworth <[email protected]>2020-05-13 21:22:16 -0400
commit0f11aa037ad8765abf66e0c90052f9e4c37d56db (patch)
treee78523c566a1a96d53098bfc7c1d1f104043d373 /sway/input/input-manager.c
parent2473cac32c9a062ddaee9d5495a72317bdd1f9ff (diff)
commands: Add per-view shortcuts_inhibitor command
Add a separate per-view shortcuts_inhibitor command that can be used with criteria to override the per-seat defaults. This allows to e.g. disable shortcuts inhibiting globally but enable it for specific, known-good virtualization and remote desktop software or, alternatively, to blacklist that one slightly broken piece of software that just doesn't seem to get it right but insists on trying. Add a flag to sway_view and handling logic in the input manager that respects that flag if configured but falls back to per-seat config otherwise. Add the actual command but with just enable and disable subcommands since there's no value in duplicating the per-seat activate/deactivate/toggle logic here. Split the inhibitor retrieval helper in two so we can use the backend half in the command to retrieve inhibitors for a specific surface and not just the currently focused one. Extend the manual page with documentation of the command and references to its per-seat sibling and usefulness with criteria. Signed-off-by: Michael Weiser <[email protected]>
Diffstat (limited to 'sway/input/input-manager.c')
-rw-r--r--sway/input/input-manager.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c
index 243f860b..dc07cbf0 100644
--- a/sway/input/input-manager.c
+++ b/sway/input/input-manager.c
@@ -15,6 +15,7 @@
#include "sway/input/cursor.h"
#include "sway/ipc-server.h"
#include "sway/server.h"
+#include "sway/tree/view.h"
#include "stringop.h"
#include "list.h"
#include "log.h"
@@ -333,12 +334,25 @@ 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("*");
+ // per-view, seat-agnostic config via criteria
+ struct sway_view *view = view_from_wlr_surface(inhibitor->surface);
+ enum seat_config_shortcuts_inhibit inhibit = SHORTCUTS_INHIBIT_DEFAULT;
+ if (view) {
+ inhibit = view->shortcuts_inhibit;
}
- if (config && config->shortcuts_inhibit == SHORTCUTS_INHIBIT_DISABLE) {
+ if (inhibit == SHORTCUTS_INHIBIT_DEFAULT) {
+ struct seat_config *config = seat_get_config(seat);
+ if (!config) {
+ config = seat_get_config_by_name("*");
+ }
+
+ if (config) {
+ inhibit = config->shortcuts_inhibit;
+ }
+ }
+
+ if (inhibit == SHORTCUTS_INHIBIT_DISABLE) {
/**
* Here we deny to honour the inhibitor by never sending the
* activate signal. We can not, however, destroy the inhibitor