mirror of
https://github.com/sezanzeb/input-remapper
synced 2024-10-31 21:20:15 +00:00
fixed Alt_L not working
This commit is contained in:
parent
70f091f39b
commit
3e48d899ea
@ -41,7 +41,12 @@ def populate_system_mapping():
|
|||||||
xmodmap = subprocess.check_output(['xmodmap', '-pke']).decode() + '\n'
|
xmodmap = subprocess.check_output(['xmodmap', '-pke']).decode() + '\n'
|
||||||
mappings = re.findall(r'(\d+) = (.+)\n', xmodmap)
|
mappings = re.findall(r'(\d+) = (.+)\n', xmodmap)
|
||||||
for keycode, names in mappings:
|
for keycode, names in mappings:
|
||||||
for name in names.split():
|
# there might be multiple, like:
|
||||||
|
# keycode 64 = Alt_L Meta_L Alt_L Meta_L
|
||||||
|
# keycode 204 = NoSymbol Alt_L NoSymbol Alt_L
|
||||||
|
# only the first column is relevant. The others can be achieved
|
||||||
|
# by using a modifier button and the mapped key
|
||||||
|
name = names.split()[0]
|
||||||
mapping[name] = int(keycode) - XKB_KEYCODE_OFFSET
|
mapping[name] = int(keycode) - XKB_KEYCODE_OFFSET
|
||||||
|
|
||||||
for name, ecode in evdev.ecodes.ecodes.items():
|
for name, ecode in evdev.ecodes.ecodes.items():
|
||||||
|
@ -37,7 +37,12 @@ class TestMapping(unittest.TestCase):
|
|||||||
self.assertGreater(len(mapping), 100)
|
self.assertGreater(len(mapping), 100)
|
||||||
self.assertEqual(mapping['1'], 2)
|
self.assertEqual(mapping['1'], 2)
|
||||||
self.assertEqual(mapping['KEY_1'], 2)
|
self.assertEqual(mapping['KEY_1'], 2)
|
||||||
self.assertEqual(mapping['KEY_LEFTSHIFT'], mapping['Shift_L'])
|
|
||||||
|
self.assertEqual(mapping['Alt_L'], 56)
|
||||||
|
self.assertEqual(mapping['KEY_LEFTALT'], 56)
|
||||||
|
|
||||||
|
self.assertEqual(mapping['KEY_LEFTSHIFT'], 42)
|
||||||
|
self.assertEqual(mapping['Shift_L'], 42)
|
||||||
|
|
||||||
def test_clone(self):
|
def test_clone(self):
|
||||||
mapping1 = Mapping()
|
mapping1 = Mapping()
|
||||||
|
Loading…
Reference in New Issue
Block a user