YaLTeR / niri

A scrollable-tiling Wayland compositor.
https://matrix.to/#/#niri:matrix.org
GNU General Public License v3.0
3.8k stars 113 forks source link

Modifier-only keybinds exist #605

Open miku4k opened 2 months ago

miku4k commented 2 months ago

You can set a modifier-only shortcut by using the xkb name for the modifier as the second key (e.g. Super+Super_L). Hitting just the modifier, or any keybind that includes the modifier, triggers the mod-only bind. I've only tested with Super+Super_L and the spawn action, but I believe other combinations behave similarly if not the same.

Checking that the non-mod key of a keybind isnt secretly a mod should be enough to fix this.

System Information

YaLTeR commented 2 months ago

Hm, I guess until we have release binds, this is more or less the best we can do. Though, maybe someone does use it, by carefully avoiding binds using that modifier...

dev-nicolaos commented 2 months ago

Is there an existing issue for release binds? I searched but couldn't find one. It would be nice to be able to bind an action to just Super without breaking all the other binds that use it as a modifier.

YaLTeR commented 2 months ago

I'm not sure there's an issue, but implementing release binds would involve some non trivial logic I imagine.

jakesarjeant commented 2 months ago

Is allowing mod-only binds necessarily a bug? I can think of at least a few use cases for it, but I'm not clear on what problem it causes... Anyone who doesn't want mod-only binds can just not make any, but it doesn't seem like there's any reason to disallow them for people who want them (of course, release binds are kind of necessary for them to be useful). I'm also bouncing around the idea of showing a workspace overview (see #624) while the mod key is held instead of putting it in my bar, so it seems useful to bind opening the view to Super+Super_L with a timer to close it after a few seconds.

miku4k commented 2 months ago

they can lead to unexpected behavior if they arent accounted for, which they arent especially the fact that they get executed

the disallowing them was more a temporary suggestion since i too think release binds would be complex to implement

and yes mod-only keybinds definitively have their uses (super opens some kind of menu on almost all desktops)

jakesarjeant commented 2 months ago

Maybe a better solution would be to introduce an allow-mod-only; option in the binds section of the config and disallow them otherwise?

Should be fairly straightforward to implement

dev-nicolaos commented 2 months ago

I'm having trouble imagining a mod only keybind being useful without also being a release bind. Wouldn't the bound action run on every invocation of every other shortcut that uses that mod key? If that's the case, I worry introducing an allow-mod-only option would just be a waste of time.

miku4k commented 2 months ago

yes they run every time you use that key be it in another shortcut or not.