I replaced niri's built-in show hotkeys overlay with a custom Walker menu that is searchable, multi-column and runs the command you pick #3580
nickjj
started this conversation in
Show and tell
Replies: 2 comments 1 reply
-
|
Well, it is called "Important Hotkeys" and not "All Hotkeys"... And making your own menu is perfectly fine, I believe some other project already did something similar :) |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Would you mind if i steal it and put it into the elephant-community repo? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Why
niri's hotkey overlay menu has a few concerns:
I don't know Rust enough to contribute a PR to address these and niri deserves better than AI slop. There's also an open issue discussing how to solve the first problem but a decision wasn't made on how to do it, so progress has stalled.
In my case I have the following use case with 50 hotkeys:
The custom menu
Here's what it looks like:
This gets generated by parsing binds from your niri config(s). If you pick one, it runs whatever was assigned. You don't have to add anything extra or special to your niri configs.
Here's the commit that added it and you can always find the most up to date version of it here.
I chose Walker because I already use it and it supports custom menus. It could pretty easily be ported to other finders.
Custom Walker menus are written in Lua script. I'm mostly a Python, Ruby and shell script developer. I've written a few small Neovim plugins (Lua) and enhancements but I don't really know Lua script.
I wanted to keep it as a zero dependency script so I didn't pull in any third party libraries. That means I had to write a partial KDL parser. I didn't go too crazy here but it does support recursively finding your niri configs in the order you include them, overwriting duplicate binds where the last one wins, ignores all commented lines, supports single or multi-line binds and spawn commands.
I only spent around 2 hours on it so there might be edge cases or bugs I didn't account for. If you find one please open an issue in my dotfiles or reply here. I'll do my best to fix it, or if you know how please open a PR. So far I only tested it against my niri configs where it does parse it all successfully.
Next steps
This is mainly a proof of concept. I hope in the future niri itself has something similar or better built-in so it works out of the box for everyone. Little tools like this can be used to experiment without integrating with niri itself.
Beta Was this translation helpful? Give feedback.
All reactions