Open csdvrx opened 1 year ago
I would be really nice to have a timeout option for bindr, after which the bind even would expire
fair
It would also be desirable to add window rules as both inclusions and exclusions, for example to never start amongus while reading email in thunderbird:
No
The same approach could be used require that a given application be focused, for example to only process bindr events for the SHIFT modifier when using xwayland applications:
No
tysm for the timeout!
As for the inclusion and exclusion rules, they are to improve hyprland shortcuts handling and support more scenarios: for example, if I try to bind Control_L to "navigation-history-next" (alt-right) and Alt_L alone to "navigation-history-previous" (alt-left):
# Control_L=37 -> Send Alt=56 Right=106
bindr=CONTROL,Control_L,exec, YDOTOOL_SOCKET=/run/user/1000/.ydotool_socket ydotool key 56:1 106:1 56:0 106:0
# Alt_L=64 -> Send Alt=56 Left=105
bindr=ALT,Alt_L,exec, YDOTOOL_SOCKET=/run/user/1000/.ydotool_socket ydotool key 56:1 105:1 56:0 105:0
Then pressing on Control_L causes the Alt_L bindr to also be executed, so the browser receives Alt Left Right (visible in wev, or even vim where the cursor goes quickly to the left then back to the original position)
This can't be fixed by specifying the keycode instead of the keyname:
# Control_L=37 -> Send Alt=56 Right=106
bindr=CONTROL,37,exec, YDOTOOL_SOCKET=/run/user/1000/.ydotool_socket ydotool key 56:1 106:1 56:0 106:0
# Alt_L=64 -> Send Alt=56 Left=105
bindr=ALT,64,exec, YDOTOOL_SOCKET=/run/user/1000/.ydotool_socket ydotool key 56:1 105:1 56:0 105:0
Inhibitors and required-bys seemed the easier solution to this problem, while also extending the possibilities for shortcuts.
Is there another way to have this mapping work with the existing options?
It there a specific reason why it would be bad idea?
Like, would it make a constraint tree too large or too slow that would degrade the performance or the user experience?
No, it's just an extremely niche feature that can be accomplished by a script. IMHO it doesn't belong in the core.
Ohh yes, that makes sense. I'm coming from AHK which allowed very advanced configurations: the whole Windows UI could be scripted!!
Right now it'd just be nice to have the bindl timeouts, and maybe if you can, something to replace ydotool with hyprctrl to send the keycodes.
Between these 2 simple things, a lot of advanced keymapping will become much simpler!
The more precise shortcuts (classes and inhibitors) are not exactly urgent or maybe not worth doing at all if you just see no need.
I only hope having application specific shortcuts will become possible, one way or the other, in due time.
Thanks a lot!
I would be really nice to have a timeout option for bindr, after which the bind even would expire:
For example, if using the example from the documentation, rressing and immediately releasing Alt_L yields the desired behavior:
However, pressing then keeping Alt_L down for over 10 seconds will also yield the same result, while it's likely the intend changes more by every second that passes between the key press and the key release: for example: the user may have prepared to do a Alt Tab, but then change their mind after noticing a notification about an email.
A better behavior could be achieved with a timeout starting at the press event, then cancelling the bindr action if the timeout is reached without a bindr event, like for 2 seconds:
In this case, holding the Alt_L for longer than 2 seconds would inhibit the bindr action: among would not have been started past 2 seconds of holding the key down.
It would also be desirable to add window rules as both inclusions and exclusions, for example to never start amongus while reading email in thunderbird:
The same approach could be used require that a given application be focused, for example to only process bindr events for the SHIFT modifier when using xwayland applications:
Alt_L would work as before, but using something xwayland would prevent the bindr for SHIFT modifiers.
This would allow application specific shortcuts, as it could also possible more generally to only process regular bind events for say the CONTROL modifier when using kitty: