diff --git a/keymapper/dev/macros.py b/keymapper/dev/macros.py index 037d3777..29c26926 100644 --- a/keymapper/dev/macros.py +++ b/keymapper/dev/macros.py @@ -31,7 +31,7 @@ Examples -------- r(3, k(a).w(10)): a <10ms> a <10ms> a r(2, k(a).k(-)).k(b): a - a - b -w(1000).m(SHIFT_L, r(2, k(a))).w(10).k(b): <1s> A A <10ms> b +w(1000).m(Shift_L, r(2, k(a))).w(10).k(b): <1s> A A <10ms> b """ @@ -280,7 +280,7 @@ def parse(macro, handler): macro : string "r(3, k(a).w(10))" "r(2, k(a).k(-)).k(b)" - "w(1000).m(SHIFT_L, r(2, k(a))).w(10, 20).k(b)" + "w(1000).m(Shift_L, r(2, k(a))).w(10, 20).k(b)" handler : func A function that accepts keycodes as the first parameter and the key-press state as the second. 1 for down and 0 for up. The diff --git a/keymapper/gtk/window.py b/keymapper/gtk/window.py index 0d99ab43..4642dc6c 100755 --- a/keymapper/gtk/window.py +++ b/keymapper/gtk/window.py @@ -70,6 +70,7 @@ def get_selected_row_bg(): # TODO show if the preset is being injected +# apply button -> stop button. makes "Apply Defaults" obsolete class Window: diff --git a/tests/testcases/injector.py b/tests/testcases/injector.py index ead436f0..da5b4412 100644 --- a/tests/testcases/injector.py +++ b/tests/testcases/injector.py @@ -220,7 +220,7 @@ class TestInjector(unittest.TestCase): self.assertAlmostEqual(history[-2][2], -1) def test_injector(self): - custom_mapping.change(8, 'k(q).k(w)') + custom_mapping.change(8, 'k(KEY_Q).k(w)') custom_mapping.change(9, 'a') # one mapping that is unknown in the system_mapping on purpose custom_mapping.change(10, 'b') @@ -230,7 +230,7 @@ class TestInjector(unittest.TestCase): code_q = 101 code_w = 102 system_mapping['a'] = code_a - system_mapping['q'] = code_q + system_mapping['KEY_Q'] = code_q system_mapping['w'] = code_w # the second arg of those event objects is 8 lower than the diff --git a/tests/testcases/mapping.py b/tests/testcases/mapping.py index 5a873eae..be4d7529 100644 --- a/tests/testcases/mapping.py +++ b/tests/testcases/mapping.py @@ -33,8 +33,11 @@ class TestMapping(unittest.TestCase): def test_populate_system_mapping(self): mapping = populate_system_mapping() self.assertGreater(len(mapping), 100) - # keycode 10 is typically mapped to '1' + # xkb keycode 10 is typically mapped to '1' self.assertEqual(mapping['1'], 10) + # linux keycodes are properly increased to the xkb keycodes + self.assertEqual(mapping['KEY_1'], 10) + self.assertEqual(mapping['KEY_LEFTSHIFT'], mapping['Shift_L']) def test_clone(self): mapping1 = Mapping()