-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
socket2: add {,de}populateworkspace events #12488
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: main
Are you sure you want to change the base?
Conversation
|
why? You can already do this with existing infra. |
|
When making bars/shells with special indicators for empty and populated workspaces, it looks like people currently make calls to the request socket whenever the response of |
|
ok, I see. v2 is redundant though, v2 was because v1 sucked of a few events. Make one event. |
|
Did you mean one event each(so |
|
just getting rid of v2 |
| // emit the IPC event before the layout might focus the window to avoid a focus event first | ||
| g_pEventManager->postEvent(SHyprIPCEvent{"openwindow", std::format("{:x},{},{},{}", m_self.lock(), PWORKSPACE->m_name, m_class, m_title)}); | ||
| EMIT_HOOK_EVENT("openWindowEarly", m_self.lock()); | ||
| if (workspacePreviouslyEmpty) { |
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.
no {}
|
|
||
| // emit the hook event here after basic stuff has been initialized | ||
| EMIT_HOOK_EVENT("openWindow", m_self.lock()); | ||
| if (workspacePreviouslyEmpty) { |
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.
no {}
|
also pls add tests |
Describe your PR, what does it fix/add?
This PR adds 2 events to the events socket: populateworkspace and depopulateworkspace. The former is emitted when an empty workspace gains a window, while the latter is emitted when a workspace no longer has any windows.
Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)
I tested it with this:
Rust code
Demonstration video
A red circle in the the workspace indicator window at the top(which is separate) means that a workspace is populated, while grey means that it is not.
The only issue that I have seen(from my limited testing) is that, sometimes, events are not emitted in the correct order when you use themovetoworkspacedispatch, as can be see from second 29 until the end. I'm not sure why that happens.EDIT: That only seems to happen from the notification side of things in the script I sent. Simply printing each time an event occurs seems to reliably preserve the order of events.
Is it ready for merging, or does it need work?
I think that it is ready for merging
if that issue is not a dealbreaker.