-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add --allow-other flag for keybindings #7602
base: master
Are you sure you want to change the base?
Conversation
This flag allows other keys to be pressed at the same time as the binding. This acts as follows: - All key modifiers not explicitly listed in the binding are ignored. The binding's modifiers are still required to be pressed. - If other keys are pressed between press and release, release is still triggered.
What is the expected behavior if another binding is pressed which has a superset of the listed keys? Both activate? Only one? What if they both have the flag? I think it makes sense to add some way to allow the user to type while a binding is held, since as you say this functionality exists on X and not in sway currently. |
I would expect both to activate, assuming the subset has the flag and the superset either does or does not (this reminds me of how annoying it was to have language switching set to Ctrl+Shift/Alt+Shift break resp Ctrl+Shift+Tab/Alt+Shift+Tab when switching from Windows). However, adding that to sway would probably be quite hacky as it seems like it only supports one binding per keypress (or per key sequence?), so in my opinion this is a nice middle ground between required changes and features gained. I can extend it to handle multiple bindings for a single keypress, but I'd like to receive more general feedback first (and it wouldn't be that useful overall). Also, at the moment the code in this PR is somewhat buggy, in very rare cases the release binding doesn't get called, but it only happened four times in a few days of testing and I couldn't figure out which conditions it happens under (seemingly the release event for the key just didn't trigger at all, I can't find any other explanation from looking at the code). |
I just applied the a patch and found a way to replicate it on my end: When I press and hold button9 Push-to-talk activates as expected, however if I keep holding it and press any other mouse button at the same time it gets stuck until I press and release button9 again. |
Just tried it again and it seems like the |
it definitely worked for me, I'll test this again later |
while I haven't been able to reproduce your issue, here's my config:
|
Just tried the patch again and the allow_other logic seems to work fine. I use the following bindings:
When I press To reproduce I tried the same with
It seems like the issue only occurs if the inputs come from the same device, e.g. pressing |
This flag allows other keys to be pressed at the same time as the binding. This acts as follows:
The particular use case for me is Mumble push-to-talk.
In games, you often talk at the same time as doing something else in-game. Before, I had this rather abysmal config since sway doesn't support ignoring key modifiers for bindings (I have a mouse button that I use for PTT programmed to Scroll Lock, a mostly unused key, to make sure games don't do anything when I press the key):
However, this had one major issue - if I pressed any other key between the press and release of Scroll_Lock, the release binding wouldn't execute, and my microphone would be kept active until someone tells me about it and I press the key again, just to release it and execute the release binding. This PR introduces a flag for what I consider ideal push to talk behavior.
The reason this is necessary in the first place is because on X, there is some part of the spec that allows intercepting all keypresses which Mumble uses. There's no such thing on Wayland, closest thing I could find is this merged PR for xdg-desktop-portal, but I don't think there's an easy way to make xdg-desktop-portal-wlr support it without a completely new Wayland protocol supported by wlroots, and Mumble doesn't use the xdg-desktop-portal global shortcuts API yet anyway. See emersion/xdg-desktop-portal-wlr#240
This fills the last major gap I had in experience between X and Wayland. Understandably, i3 doesn't have this feature because it isn't necessary there. Feedback is welcome on making this apply to more situations than just push to talk (or on getting a better name). If the xdg-desktop-portal solution is preferred (and feasible), I'm fine with closing this and using this as a patch until xdg-desktop-portal-wlr becomes more mature.
Closes #6456
Prior art: #6616 #6920