Skip to content

Cursor visibility modifier on Windows#385

Open
suzuh wants to merge 5 commits into
houmain:mainfrom
suzuh:cursor-visibility
Open

Cursor visibility modifier on Windows#385
suzuh wants to merge 5 commits into
houmain:mainfrom
suzuh:cursor-visibility

Conversation

@suzuh

@suzuh suzuh commented Jul 14, 2026

Copy link
Copy Markdown

New virtual key "CursorVisible" that changes depending on the mouse cursor visibility
It is pressed when the cursor is visible, and released when the cursor is hidden
This modifier can be useful in games where you need different mappings in menus (visible cursor) and in-game (hidden cursor)

Limitations:

  • Only works on Windows
  • Can only detect hardware cursor changes

It can be used as a modifier in context blocks or mappings

Example context blocks:

[path = "program.exe", modifier = "CursorVisible"]
# Mappings under this context block will only work while the cursor is visible
[path = "program.exe", modifier = "!CursorVisible"]
# Mappings under this context block will only work while the cursor is hidden

Example mappings:

CursorVisible{E} >> PageDown
CursorVisible D >> Space
(CursorVisible W) >> I
!CursorVisible A >> Left

@suzuh

suzuh commented Jul 14, 2026

Copy link
Copy Markdown
Author

This is the feature I mentioned before in #354

I'm just not sure if these changes in Key.h are the correct way of dealing with the new virtual key

CursorVisible = 0xFB00

constexpr bool is_virtual_key(Key key) {
    return ((key >= Key::first_virtual && key <= Key::last_virtual) || key == Key::CursorVisible);
}

constexpr int get_virtual_key_count() {
    return (*Key::last_virtual - *Key::first_virtual + 2); // + 2 to include CursorVisible
}

Everything works, but there could be a better way I'm not seeing

@suzuh
suzuh marked this pull request as ready for review July 14, 2026 17:44
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.

1 participant