LGUG2Z / whkd

A simple hotkey daemon for Windows
MIT License
529 stars 12 forks source link

[FEAT]: Mapping key sequences #19

Closed d-r-a-b closed 1 year ago

d-r-a-b commented 1 year ago

Is your feature request related to a problem? Please describe. Hotkeys sequences, similar to how vim keymaps work (e.g. vip for select v in paragraph ip), would be a nice way to have consistent behavior and reduce the necessary hotkey domain space which needs to be mapped (and might therefore interact poorly with application-specific hotkeys).

Describe the solution you'd like An example would be a configuration line like the following:

alt + super, alt + h : komorebic focus left

Which I would want to allow me to hit Alt+Super, then hit Alt+h to focus left. This helps mask the Alt+h keybinding to a specific context and makes it less likely to interfere with an application map. This feature would probably need a configurable time out parameter as well.

Overall the value of this feature depends on how many keymap-intensive applications a specific user has and the extent to which they require more maps to fiddle with window layouts in more complex ways vs. just choosing a main window and tossing the rest in a stack to the side.

Describe alternatives you've considered (caveat: I just found out about this project, so my understanding may be limited. Please excuse any ignorance)

This might already be possible by manually managing state within the config file. I noticed that there is conditional logic in the example in the README, so a persistent value store and timestamp mechanisms could allow for this type of thing to be managed by the user, as opposed to implementing parser support and logic for this feature directly in whkd. The other thing a user would need to figure out how to do this would be a "passthrough" mechanism so that the hotkey can bubble into the application instead of just being trapped by whkd (if indeed whkd does any kind of trapping). I'm not sure if these things (persistent value store, programmatic calls to get time, passthrough) are already available or not and I am extremely new to cmd/PowerShell specifically in comparison to linux CLI tools.

Additional context Not really sure if this fits with the project vision, and a wontdo close would be totally appropriate. Just found out about this project and komorebi and it looks very interesting. Thank you for making it available!

LGUG2Z commented 1 year ago

I think it may be worth seeing if you can achieve this functionality with kanata, which already has support for Vim-like leader sequences, and can be compiled with support for command execution.

That being said, I don't have any objection to someone coming up with a proposal for how to implement this both on the parser level (syntax etc.) and on the win32 API level if anybody wants to run with the idea.

d-r-a-b commented 1 year ago

Awesome, thanks for the link! Kanata looks very cool. I'll close this for now since I think it will fit needs.

LGUG2Z commented 1 year ago

@d-r-a-b If you use it, you can also consider komokana to integrate komorebi with kanata and automatically switch keyboard layers depending on the focused app. 🚀