-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
support binding actions to switches #747
Conversation
Hmm, how does it work in other compositors? Also what happens if you e.g. suspend, then switch to tablet mode, then unsuspend? |
afaik sway has something similar with
though there is also the option to react on Will test the suspend behavior. |
Okay, so it seems I can not directly un-suspend in tablet mode, even the power button is disabled. But I can with an external keyboard. Also I can suspend in Tablet Mode and unsuspend in non Tablet Mode. In both cases the switch does not seem to trigger. But tbh I am not sure handling these cases is important. This would probably require keeping some state somewhere and query the current state after resume. |
8cc55df
to
60aaef2
Compare
I just had a shower thought, what if instead of putting this into the binds section with its intercept and repeat and all, this just was in its own section? Maybe even only allow a spawn action? With a comment mentioning that the command may be spawned extra times like on compositor start or w/e. |
Sure, you had something more static in mind or still keep it dynamic as with the I tested lid with something like
which also works nicely (ignoring suspend and so on for now).
Sure, as long as the command can be considered idempotent I don't see a reason against just re-run it on something like un-suspend or config reloads. |
(just a side-note, I am still not really happy with the virtual keyboard in tablet mode. LibreOffice Calc just seems to always request input method and I don't see a way to hide the keyboard....) |
I think something more static would make sense here. E.g.
(names and structure up for discussion)
I think they're proposing a Wayland request to enable/disable the osk, wonder if that'll help here.. |
k, sounds good, will do that change tomorrow. maybe we want to keep some options like
Hm, let's see how this turns out. Current state seems quite annoying :/ |
Hm, I thought it would make sense to allow those when locked by default (and document it I guess). |
9d1a47a
to
0dbf6ab
Compare
this adds a new config section named `switch-events` that allows to bind `spawn` action to certain switch toggles.
0dbf6ab
to
7f89c7c
Compare
Okay, added the new section and implemented the logic to just always run the configured actions. Seems we can not query the state of the switches, at least not directly through libinput, so we can not easily run the actions other then in response to receiving a libinput toggle event. But so far I have not seen issues with this, even turning We could store the current state in a map per switch and re-run on config changes, but I am not sure this is really worth implementing? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Seems we can not query the state of the switches, at least not directly through libinput, so we can not easily run the actions other then in response to receiving a libinput toggle event. But so far I have not seen issues with this, even turning
the monitor back on after resume seems to work fine.
Interesting, I see.
If needed turning off could be limited to multi-monitor setup with something like
[ $(niri msg --json outputs | jq length) -gt 1 ] && niri msg output "eDP-1" off
.
Ideally that should happen automatically but it's out of scope for this PR. It's nice that you can do it manually at least.
We could store the current state in a map per switch and re-run on config changes, but I am not sure this is really worth implementing?
Nah, I think it's fine as is.
Thanks! |
Not sure this is the right approach, but it seems to work fine so far. Though the switch bindings should probably be also run during startup.