Context
When kanata live-reloads config, definputdevices changes are parsed into self.input_devices but KbdIn.device_hash_to_id (the runtime hash→device_id map) is not rebuilt. This means (device N) switch conditions use stale mappings after reload.
Currently we skip updating self.input_devices on reload to match existing behavior for other device configs (macos-dev-names-include, linux-dev, etc.), which are all documented as not re-read on live reload.
Proposed improvement
Rebuild the device_hash_to_id map on live reload when definputdevices changes. This would require either:
- Exposing a method on
KbdIn to rebuild the map from new matchers, or
- Storing the map separately from
KbdIn (e.g., on Kanata) so it can be replaced on reload
This would make definputdevices the first device-related config that supports live reload, which may be desirable since it only affects ID assignment — not which devices are grabbed.
Related
Context
When kanata live-reloads config,
definputdeviceschanges are parsed intoself.input_devicesbutKbdIn.device_hash_to_id(the runtime hash→device_id map) is not rebuilt. This means(device N)switch conditions use stale mappings after reload.Currently we skip updating
self.input_deviceson reload to match existing behavior for other device configs (macos-dev-names-include,linux-dev, etc.), which are all documented as not re-read on live reload.Proposed improvement
Rebuild the
device_hash_to_idmap on live reload whendefinputdeviceschanges. This would require either:KbdInto rebuild the map from new matchers, orKbdIn(e.g., onKanata) so it can be replaced on reloadThis would make
definputdevicesthe first device-related config that supports live reload, which may be desirable since it only affects ID assignment — not which devices are grabbed.Related