Skip to content

fix(inject,core): map Cmd/Win/Super/Meta to the platform's own key - #1454

Open
4ni1ak wants to merge 1 commit into
AprilNEA:masterfrom
4ni1ak:fix/windows-cmd-modifier-893
Open

4ni1ak wants to merge 1 commit into
AprilNEA:masterfrom
4ni1ak:fix/windows-cmd-modifier-893

Conversation

@4ni1ak

@4ni1ak 4ni1ak commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • CustomShortcut's config parser already accepted cmd/command/meta/win
    as aliases for one cross-platform "Command" modifier bit, but Windows and
    Linux injection silently folded that modifier into Ctrl instead of the
    actual Windows-key/Super — so Cmd+Down sent Ctrl+Down on Windows (or,
    combined with an explicit Ctrl in the same chord, deduplicated into a
    single Ctrl press), and never the Super/Meta key a Wayland/X11 compositor
    binds shortcuts to on Linux. Six separate user reports across Windows and
    Linux confirmed the same mechanism.
  • Also adds super as an accepted parser alias, alongside the existing
    meta/win — a Linux reporter noted Super+X was rejected outright and,
    worse, made the whole config fail to parse.

Changes

  • crates/openlogi-inject/src/inject.rs: the shared HeldKey::Command
    variant is no longer macOS-only; held_keys() now pushes Command for
    has_command() and Control for has_control() independently on every
    platform, instead of folding Command into Control on Linux/Windows.
  • crates/openlogi-inject/src/inject/windows.rs: combo_modifiers maps
    has_command() to VK_LWIN (the Windows key) instead of VK_CONTROL;
    held_virtual_key gets a matching HeldKey::Command => VK_LWIN arm.
  • crates/openlogi-inject/src/inject/linux.rs: modifiers_to_keycodes maps
    has_command() to KEY_LEFTMETA (Super) instead of folding it into
    KEY_LEFTCTRL; held_keycode gets a matching arm. KEY_LEFTMETA was
    already a registered virtual-device capability (used by the LockScreen
    Super+L fallback), just unused for CustomShortcut.
  • crates/openlogi-core/src/binding/key_combo.rs: accept super as a parser
    alias for the Command modifier.

Testing

  • cargo test -p openlogi-core -p openlogi-inject — updated/added tests:
    command_meta_win_and_super_are_the_same_modifier (parser), a rewritten
    command_and_control_are_distinct_physical_outputs /
    shared_command_stays_down_until_its_last_chord_ends (now exercised on
    every platform instead of macOS-only), and new
    cmd_maps_to_the_windows_key_distinct_from_ctrl /
    win_and_meta_and_super_are_accepted_aliases_for_cmd (Windows),
    cmd_maps_to_super_distinct_from_ctrl /
    super_and_meta_are_accepted_aliases_for_cmd (Linux).
  • cargo check/cargo clippy --target x86_64-pc-windows-gnu for the Windows
    cfg-gated code (this host has no Windows runtime to execute tests on, but
    the Linux-equivalent logic is unit-tested and the two implementations are
    structurally identical).
  • cargo fmt --all -- --check
  • RUSTFLAGS="-D warnings" cargo clippy --workspace --all-targets -- -D warnings
  • RUSTFLAGS="-D warnings" cargo test --workspace
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items --exclude openlogi-ui --exclude openlogi-desktop --exclude openlogi-overlay --exclude openlogi-agent
  • Not runtime-tested on real Windows or Linux hardware — the mapping is
    proven by the unit tests above and cross-compilation for Windows; a
    maintainer with a Windows or Wayland/X11 machine can confirm Cmd+Down
    now sends the actual Windows/Super key.

Fixes #893

CustomShortcut's config parser already accepted "cmd"/"command"/"meta"/"win"
as aliases for one cross-platform modifier bit, but Windows and Linux
injection silently folded that modifier into Ctrl instead of the actual
Windows/Super key — so "Cmd+Down" sent Ctrl+Down (or, combined with an
explicit Ctrl in the chord, just deduplicated into a single Ctrl), never the
Windows key or Super/Meta a Wayland/X11 compositor binds shortcuts to.

Give Cmd its own physical output on every platform: VK_LWIN on Windows,
KEY_LEFTMETA on Linux (already a registered virtual-device capability, just
unused for CustomShortcut), matching macOS's existing Cmd/Ctrl distinction.
Also accept "super" as a parser alias, alongside the existing "meta"/"win".

Fixes AprilNEA#893
@greptile-apps

greptile-apps Bot commented Sep 17, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the parser, immediate injection, and held-chord paths consistently implement the intended native Command-key semantics.

Summary

The PR makes the platform-neutral Command modifier produce the platform’s native Command/Windows/Super key and adds super as a configuration alias.

  • Keeps Command and Control as distinct held outputs across macOS, Linux, and Windows.
  • Maps Command to KEY_LEFTMETA on Linux and VK_LWIN on Windows.
  • Preserves balanced modifier ownership across overlapping held chords.
  • Canonicalizes cmd, command, meta, win, and super to the same persisted and displayed modifier.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
    Config["Cmd / Command / Meta / Win / Super"] --> Combo["KeyCombo: MOD_COMMAND"]
    Combo --> Linux["Linux: KEY_LEFTMETA"]
    Combo --> Windows["Windows: VK_LWIN"]
    Combo --> Mac["macOS: Command"]
    Ctrl["Ctrl / Control"] --> ControlBit["KeyCombo: MOD_CONTROL"]
    ControlBit --> NativeCtrl["Platform Control key"]
Loading

Reviews (1) · Last reviewed commit: "fix(inject,core): map Cmd/Win/Super/Meta..."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: "Cmd" modifier in CustomShortcut doesn't trigger the Windows key on Windows

1 participant