-
Notifications
You must be signed in to change notification settings - Fork 52
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
Feat: sway-mode module #671
Feat: sway-mode module #671
Conversation
dbd1a18
to
d91e4b3
Compare
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.
Hey, thanks for this. It looks very good, just a few nits.
The build is failing at the moment due to a separate issue that's fixed on master - rebasing should resolve that.
Are you also able to provide some evidence of this working please? I can't get Sway to run at the moment :( A couple of screenshots or a quick vid is fine.
src/modules/sway/mode.rs
Outdated
let Event::Mode(mode) = event else { | ||
unreachable!() | ||
}; |
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.
I'm not a fan of requiring this when the type is (sorta) already specified in the call. I can't see how to avoid it nicely though. Any ideas?
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.
I created a SwayIpcEvent
trait with a associated const EVENT_TYPE: EventType
and a fn from_event(&Event) -> &Self
method, implemented to all event types, and used that to fix this issue.
521665e
to
911545d
Compare
Now `sway::Client` is store in `ironbar.clients`, and allow dynamically registering event listeners, instead of hardcoding events for Workspace updates. Remove the use of `swayipc::Connection` from `sway-mode` module, and replace it with the new event listener system.
Avoiding unwrapping the event enum in the caller code.
The module `compositor` is gated behind the `workspaces` feature, but `sway::Client` is no longer used only by the `workspaces` module.
911545d
to
853c5d7
Compare
I believe I have addressed all points. Here is a video of the sway mode working: output.mp4 |
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.
Code all lgtm, cheers for making those changes & cheers for the vid.
One last thing before I approve - could you update docs/sidebar.md
to add an entry for the docs page pls
@JakeStanger done. |
@JakeStanger all done. (just in case my last comment didn't trigger a notification) |
Cheers! |
Add a new module, similar to the waybar "sway/module" module. It shows the current mode under sway. For that, it needs to communicate with the Sway IPC. In this PR, the module is called "sway-mode" because "sway/mode" didn't work in my YAML config file (it would probably work if I surrounded it with quotes, but I didn't test).
This PR has two commits: the first one implements the module using a new sway connection. The second one refactors the sway
Client
, underclients::compositor::sway
, to allow dynamically registering events, instead of only handling Workspace update ones. This second commit avoid creating a new socket for each module that needs to communicate with the Sway IPC, not sure if that is a problem to begin with.