first
sezanzeb 4 years ago
parent d7cd8ebe8e
commit 6a238b4953

@ -11,8 +11,9 @@ work.
# Roadmap
- [x] show a dropdown to select an arbitrary device from `xinput list`
- [x] creating plugins per device
- [ ] renaming plugins
- [x] creating presets per device
- [ ] support X, but make it somewhat easy to add wayland to this tool.
- [ ] renaming presets
- [ ] load xmodmap files from the config path
- [x] show a list that can be extended with a `[+]` button
- [ ] The list shows `[keycode, current key for that keycode -> target]`

@ -120,8 +120,11 @@ class Window:
"""Show the available presets for the selected device."""
presets = get_presets(self.selected_device)
preset_selection = self.get('preset_selection')
preset_selection.remove_all()
for preset in presets:
preset_selection.append(preset, preset)
# and select the newest one (on the top)
preset_selection.set_active(0)
def on_select_device(self, device):
"""List all presets, create one if none exist yet."""

@ -58,13 +58,17 @@ def find_devices():
def get_presets(device):
"""Get all configured presets for the device.
"""Get all configured presets for the device, sorted by modification date.
Parameters
----------
device : string
"""
return os.listdir(get_config_path(device))
device_folder = get_config_path(device)
logger.debug('Listing presets in %s', device_folder)
if not os.path.exists(device_folder):
os.makedirs(get_config_path(device_folder))
return os.listdir(get_config_path(device_folder))
def create_preset(device, name=None):

Loading…
Cancel
Save