diff --git a/README.md b/README.md
index 5c6e48ff..9dadd6aa 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ work.
# Running
-```
+```bash
sudo python3 setup.py install && sudo key-mapper-gtk -d
```
@@ -26,7 +26,7 @@ No idea which one are relevant at the moment
sudo is required because some tests actually read /dev stuff.
-```
+```bash
sudo python3 setup.py install && sudo python3 tests/test.py
```
diff --git a/bin/key-mapper-gtk b/bin/key-mapper-gtk
index 5231f456..2cb83806 100755
--- a/bin/key-mapper-gtk
+++ b/bin/key-mapper-gtk
@@ -129,7 +129,12 @@ class Window:
else:
logger.debug('Presets for "%s": %s', device, ', '.join(presets))
preset_selection = self.get('preset_selection')
+
+ preset_selection.handler_block_by_func(self.on_select_preset)
+ # otherwise the handler is called with None for each removed preset
preset_selection.remove_all()
+ preset_selection.handler_unblock_by_func(self.on_select_preset)
+
for preset in presets:
preset_selection.append(preset, preset)
# and select the newest one (on the top)
diff --git a/data/key-mapper.glade b/data/key-mapper.glade
index fb8b6e6e..e42f5d05 100644
--- a/data/key-mapper.glade
+++ b/data/key-mapper.glade
@@ -6,25 +6,49 @@
450FalseKey Mapper
+ False
diff --git a/data/screenshot.png b/data/screenshot.png
index a3b24312..25786349 100644
Binary files a/data/screenshot.png and b/data/screenshot.png differ
diff --git a/keymapper/presets.py b/keymapper/presets.py
index c9a27179..e607888c 100644
--- a/keymapper/presets.py
+++ b/keymapper/presets.py
@@ -42,14 +42,21 @@ def get_devices():
return _devices
devices = [evdev.InputDevice(path) for path in evdev.list_devices()]
+
# group them together by usb device because there could be stuff like
# "Logitech USB Keyboard" and "Logitech USB Keyboard Consumer Control"
grouped = {}
for device in devices:
+ # only keyboard devices
+ # https://www.kernel.org/doc/html/latest/input/event-codes.html
+ if not evdev.ecodes.EV_KEY in device.capabilities().keys():
+ continue
+
usb = device.phys.split('/')[0]
if grouped.get(usb) is None:
grouped[usb] = []
grouped[usb].append((device.name, device.path))
+
# now write down all the paths of that group
result = {}
for group in grouped.values():