summarylogtreecommitdiffstats
path: root/modifiers.patch
diff options
context:
space:
mode:
Diffstat (limited to 'modifiers.patch')
-rw-r--r--modifiers.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/modifiers.patch b/modifiers.patch
new file mode 100644
index 000000000000..c70f9b85bf09
--- /dev/null
+++ b/modifiers.patch
@@ -0,0 +1,53 @@
+From bc580120f9e8e8cfea0b68d9a3cf2af670a7f2f2 Mon Sep 17 00:00:00 2001
+From: Ben Reaves <rbreaves@gmail.com>
+Date: Fri, 1 May 2020 16:33:53 -0500
+Subject: [PATCH] - Persistent modifiers on partial release of modifier combo.
+ Fixes #74
+
+---
+ xkeysnail/output.py | 6 +++++-
+ xkeysnail/transform.py | 6 ++++--
+ 2 files changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/xkeysnail/output.py b/xkeysnail/output.py
+index 4605ab3..a7f2a95 100644
+--- a/xkeysnail/output.py
++++ b/xkeysnail/output.py
+@@ -76,12 +76,16 @@ def send_combo(combo):
+ for modifier in missing_modifiers:
+ modifier_key = modifier.get_key()
+ send_key_action(modifier_key, Action.PRESS)
+- pressed_modifier_keys.append(modifier_key)
+
+ send_key_action(combo.key, Action.PRESS)
+
+ send_key_action(combo.key, Action.RELEASE)
+
++ # Release modifiers that are not physically held - ONLY
++ for modifier in missing_modifiers:
++ modifier_key = modifier.get_key()
++ send_key_action(modifier_key, Action.RELEASE)
++
+ for modifier in reversed(released_modifiers_keys):
+ send_key_action(modifier, Action.PRESS)
+
+diff --git a/xkeysnail/transform.py b/xkeysnail/transform.py
+index 76ca6f2..e3ad6fd 100644
+--- a/xkeysnail/transform.py
++++ b/xkeysnail/transform.py
+@@ -427,8 +427,10 @@ def on_key(key, action, wm_class=None, quiet=False):
+ # is released
+ if str(key) != "Key.LEFT_SHIFT" and str(key) != "Key.RIGHT_SHIFT":
+ for output_key in output_mods:
+- update_pressed_modifier_keys(output_key, action)
+- send_key_action(output_key, action)
++ # Release modifiers that are not physically held - ONLY
++ if not is_pressed(output_key):
++ update_pressed_modifier_keys(output_key, action)
++ send_key_action(output_key, action)
+ elif not action.is_pressed():
+ if is_pressed(key):
+ send_key_action(key, action)
+--
+2.26.2
+