From 34e615775720fa323be123c4b48c7658930c6f81 Mon Sep 17 00:00:00 2001 From: Alexander Oakman Date: Mon, 19 Aug 2024 22:31:17 +0300 Subject: [PATCH 1/2] Allow some applications to inhibit shortcuts Virtualization and remote desktop applications should be able to inhibit keyboard shortcuts. --- etc/sway/config.d/30-applications-defaults.conf | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/etc/sway/config.d/30-applications-defaults.conf b/etc/sway/config.d/30-applications-defaults.conf index 24a3400..37af7e0 100644 --- a/etc/sway/config.d/30-applications-defaults.conf +++ b/etc/sway/config.d/30-applications-defaults.conf @@ -64,3 +64,12 @@ for_window [con_mark="Browser"] { # keyboard. Chrome currently abuses this by enabling it for all "--app=..." # shortcuts. seat * shortcuts_inhibitor disable + +# mark applications for which shortcuts inhibition is allowed +for_window [class="[Vv]irt-"] mark Grabbing +for_window [class="[Rr]eminna"] mark Grabbing +for_window [app_id="[Vv]irt-"] mark Grabbing +for_window [app_id="[Rr]emmina"] mark Grabbing + +# inhibit keyboard shortcuts for marked applications +for_window [con_mark="Grabbing"] shortcuts_inhibitor enable From 1fc0ce29c32c1a648860841c964535334acb6457 Mon Sep 17 00:00:00 2001 From: Alexander Oakman Date: Mon, 19 Aug 2024 22:40:56 +0300 Subject: [PATCH 2/2] Add a keybinding to toggle shortcuts inhibitor --- etc/sway/modes/default.conf | 3 +++ etc/sway/variables | 3 +++ 2 files changed, 6 insertions(+) diff --git a/etc/sway/modes/default.conf b/etc/sway/modes/default.conf index c91ecf1..a00b386 100644 --- a/etc/sway/modes/default.conf +++ b/etc/sway/modes/default.conf @@ -124,6 +124,9 @@ $bindsym $mod+Shift+n exec /usr/share/sway/scripts/first-empty-workspace.py --mo ## Action // Move focused window to a new workspace and switch there ## $bindsym $mod+Shift+m exec /usr/share/sway/scripts/first-empty-workspace.py --move --switch +## Action // Toogle shortcuts inhibition // $mod + Control_R ## +$bindsym --inhibited $mod+Control_R exec $toggle_shorcuts_inhibitor + # # Layout stuff: # diff --git a/etc/sway/variables b/etc/sway/variables index 5ddcf7b..d687209 100644 --- a/etc/sway/variables +++ b/etc/sway/variables @@ -124,3 +124,6 @@ set $calendar_daemon 'calcurse --daemon' # Notifications from Swappy set $swappy_notify '[ -x "$(command -v swappy)" ] && /usr/share/sway/scripts/screenshot-notify.sh' + +# Toggle shortcuts inhibition mode for the current focused window +set $toggle_shorcuts_inhibitor 'swaymsg "seat - shortcuts_inhibitor toggle"'