Skip to content

feat: rebuild device_hash_to_id map on live reload #13

@malpern

Description

@malpern

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:

  1. Exposing a method on KbdIn to rebuild the map from new matchers, or
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions