-
Notifications
You must be signed in to change notification settings - Fork 89
feat(inhibit): Add inhibit module #1190
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
base: master
Are you sure you want to change the base?
Conversation
JakeStanger
left a comment
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.
Thanks for this.
I've raised a few comments around areas I feel need attention before this can go in. If you have any questions let me know.
There are a lot of places where the code feels quite cramped - can you add some blank lines between statements to try and space things out a bit please? The rest of the codebase should give a feel.
|
These are solid points Will get back with an updated PR. |
|
My personal opinion on that:
I'd therefore say Wayland by default, Systemd available as fallback. |
209f0a9 to
145810e
Compare
|
Ended up needing a new client and removing systemd (for v1) and figured you'd have some thoughts. After going through client code, I agree - systemd should be postponed till a proper systemd client is created - out of scope for now. Would be wasteful to use the niche systemd use-case to drive the client. systemd should be its own flag etc - want to wait to add that.
Either way, it looks like we need a wayland conn object post gtk initialization -> implies new client. Please let me know if you have any thoughts. Not sure if its possible without perf hit to make the wayland client connection work with gtk surface id. Seems pretty core - did not want to change it. Please let me know what you think - dont like a dedicated client for this but dont see an obvious, consistent way out. Edit: High level feedback ok for now. |
|
I'm not sure if point 1 is fully correct. The wayland client gets initialised at startup (before the UI), but it persists for the application lifetime, and there are modules that both send/receive events from it consistently (clipboard, focused, launcher). The architecture is a little complicated because there's effectively two layers of channels that requests/responses need to travel through (module <--> wayland client <--> wayland environment) but it should be possible. You'd have to get the surface at request-time, rather than init-time, but that should be virtually free. I'd rather not add to the As for option 3, agreed it shoul dbe named after the service/resource name rather than the module name. For Wayland this should ideally match the protocol name. |
I had an earlier draft that tried this but ended up with one client and two wayland connections. The issue is gtk/gk4_wayland has its own wayland connection (it should really take one as an arg but oh well). Trying the window
I tried getting the widget (from button) at click and passing that. It still did not work with the non gtk wayland connection object. Why I feel this is appropriate for now: Happy to be assigned an issue to investigate: I want to run some tests to see if gtk connection is actually slower and see what tasks exactly need running before ui - perhaps they can be queued or something else. There are a few possibilities on which direction to take based on what will be found. It could have its own set of tradeoffs, testing etc - need to dig into timings, slowdowns etc between two clients. Worst case, we may decide to swap out the old connection on first inhibition as I mentioned above. Did not want to change such a core part of the code when adding a module. Keeps testing much more manageable. Lmk what you think. |
|
Might be much simpler: |
|
Good find. https://docs.gtk.org/gtk4/method.Application.inhibit.html I've not used it before, but it certainly sounds like it does what we want? If so, that'd be a much cleaner implementation. If not, am I right in thinking the need for the separate wl client stems from the request to use the bar's existing surface? If it's just that adding the complexity then using a dummy surface as before might be preferable after all. |
426d43f to
a79f5af
Compare
|
This will still need a central client-based implemenentation btw, as otherwise it will create a seperate inhibitor per module instance |
|
Its ready for review. Picked gtk over ModuleInfo for monitor name - to avoid passing around an extra arg. |
JakeStanger
left a comment
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.
Cool, getting there. I appreciate you have put a lot of work into this and there has been a lot of big changes along the way, so a big thanks for keeping at it and being so patient.
There's a few more concerns I have, most are pretty minor at this point. Once those are cleared up I reckon we'll be about ready to go.
src/clients/inhibit.rs
Outdated
| } | ||
| } | ||
|
|
||
| /// Client for managing GTK application inhibit state per monitor. |
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.
Is there a particular reason or use-case why we want this to be per monitor, if the inhibit state is system-wide? To me this would seem confusing vs sharing this state across the whole application.
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.
Yes - this is intentional. I do not want to assume much about client environments. Given the state of apis and inconsistencies, seemed better to expose what its doing while leaving in deduplication - can make it a single instance or let each module manage later. The key issue is other system components that need to respect the state set by gtk/wayland. Since the wayland api requires surface and sleep can be at the monitor level, I aggregate at monitor level.
I think this is the safest medium between no client and singleton inhibit.
A systemd/dbus client will be the other option.
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.
Sorry I'm not sure I'm following the logic here. The inhibit is created/managed at the GTK application level, which means it lives for as long as Ironbar runs and we don't need to think about the other potential APIs. Why not use a singleton?
23b57e1 to
818efc0
Compare
|
Thanks for your patience and persistence in pushing back - had a couple of false starts before realizing:
Main changes:
|
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.
Thanks again for your hard work, implementation looks solid now. One last round of tiny changes and then I think we're good to merge.
I will be holding off merging for a couple of weeks btw, as I want to ensure the GTK4 update is solid and ship that before introducing any new major features.
JakeStanger
left a comment
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.
LGTM! This'll be first in for 0.19.
|
Since you are not going to merge for a while, will undraft after running it for a while to catch any issues - a lot of interacting pieces with this one. |
158cd55 to
7f82059
Compare
|
Feel its ready. Merge and assign issues as appropriate. See this for possible hypridle bugs (that this module helped uncover). |
|
Works properly on niri compositor with Swayidle or Hypridle. |
Resolves #929.
Sample config:
Notes:
*2h => * implies 2h is picked as default.
Can pick systemd or wayland backend.
systemd persists across ironbar restarts (launches a transient service that sleeps for desired time).
wayland surface dies with ironbar process.
Inhibit.md included.