Waybar icon indicating copy to clipboard operation
Waybar copied to clipboard

[Taskbar] Add option "all_workspaces"

Open Anakael opened this issue 4 years ago • 29 comments

I have started to implement(research) feature show tasks only for current workspace. Feature will be controlled by option "all_workspaces": bool

Anakael avatar Jul 01 '20 14:07 Anakael

Very cool. How does this work with the foreign-toplevel-manager protocol? As far as I know, there is no knowledge about workspaces.

l3nkz avatar Jul 02 '20 06:07 l3nkz

Yes, there is true. And it's problem. I planned do something like in: https://github.com/Alexays/Waybar/pull/343 Information about workspaces can be obtained via IPC. Need to find way how to bind Task.id with node.id right. Any other ideas? Maybe I miss something?

Anakael avatar Jul 02 '20 19:07 Anakael

Hm, I implemented the original taskbar so that it will work on any wlroots based compositor that implements the foreign-toplevel-manager protocol. That is also the reason why the module is named wlr/taskbar. My long goal is to get support for this type of functionality (identifying the current workspace as well as knowing on which workspace the current toplevel is on) as a protocol extension into wlroots.

If you really want to use the IPC mechanism of sway for this, please make it optional for the module. For example I use the taskbar on wayfire which doesn't have such an IPC mechanism. That's also the reason why I want to get support for this into wlroots, so that this will work out of the box on many different compositors and not only on sway/wayfire …

l3nkz avatar Jul 03 '20 10:07 l3nkz

I don't really want to bound with IPC too. But not found way how to do it with foreign-toplevel. So what way to do it correctly? Write another protocol for "workspace" entity? Or register foreign-toplevel for each workspace? As I know workspace in sway use wl_seat for representation.

Anakael avatar Jul 03 '20 20:07 Anakael

Another problem: what unique id for app in foreign-toplevel? app_id is not unique. It required for case when have 2 Alacrity instance, for example and move one to another workspace.

Anakael avatar Jul 03 '20 20:07 Anakael

I don't really want to bound with IPC too. But not found way how to do it with foreign-toplevel. So what way to do it correctly? Write another protocol for "workspace" entity? Or register foreign-toplevel for each workspace? As I know workspace in sway use wl_seat for representation.

As I said. To support this properly, the foreign-toplevel-manager protocol needs to be extended and the compositors need to support it … That's quite some steps, hence I don't know when exactly this will happen.

Another problem: what unique id for app in foreign-toplevel? app_id is not unique. It required for case when have 2 Alacrity instance, for example and move one to another workspace.

If the protocol gets extended this is not a problem. If you have a look in the code, you will see that we get a special handle structure for each toplevel on our system. By using this handle one can implement all these features. However not with the sway IPC. As I said, we need support for this on the wlroots protocol level.

l3nkz avatar Jul 05 '20 10:07 l3nkz

How about writing something like toplevel_manager, but for workspace and extend toplevel_manager to pass new entity "workspace" with handler? In this case sway/workspace also can be replaced with wlr/workspaces for other WMs. Will it be right way to implement that? Or any other ideas?

Anakael avatar Jul 13 '20 22:07 Anakael

If this idea is good - let me know and I'll try to write such protocols and maybe some UMLs.

Anakael avatar Jul 13 '20 22:07 Anakael

Yes, this is what needs to be done. Have an additional protocol for workspaces in wlroots and extend the toplevel_manager protocol to also support workspaces. At least that would be how I would try to get it accepted. If you get it accepted into wlroots, than we can enhance the compositors to support this protocol and then we can extend this module and add the wlr/workspaces ;) Buts that quite some steps …

l3nkz avatar Jul 16 '20 05:07 l3nkz

Waiting for: https://github.com/swaywm/wlroots/pull/2357 https://github.com/WayfireWM/wayfire/pull/647 https://github.com/swaywm/sway/pull/5597

Anakael avatar Aug 02 '20 16:08 Anakael

@Anakael Do you have an implementation for Waybar already? It would be needed eventually for merging the protocol into wayland-protocols, because the requirement is to have at least one client implementation.

ammen99 avatar Aug 04 '20 09:08 ammen99

@Anakael Do you have an implementation for Waybar already? It would be needed eventually for merging the protocol into wayland-protocols, because the requirement is to have at least one client implementation.

I've start implement workspace module. I'll try to finish by end of the week.

Anakael avatar Aug 04 '20 09:08 Anakael

I've start implement workspace module. I'll try to finish by end of the week.

Great news! Meanwhile, I have submitted the MR herre: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/40

Let's hope it is approved.

ammen99 avatar Aug 04 '20 09:08 ammen99

@Anakael Do you have an implementation for Waybar already? It would be needed eventually for merging the protocol into wayland-protocols, because the requirement is to have at least one client implementation.

I've start implement workspace module. I'll try to finish by end of the week.

Do I understand the protocol right that it is not yet integrated into the foreign-toplevel-manager protocol? Hence, @Anakael you implement a completely separate module for workspaces based on wlroots?

l3nkz avatar Aug 04 '20 11:08 l3nkz

The protocol is just for listing the currently focused workspace (and also all available workspaces). If this gets accepted, I'll also add the corresponding event to foreign-toplevel.

ammen99 avatar Aug 04 '20 11:08 ammen99

Ok, than I understood it correctly. Great work @ammen99. Thank you very much for your effort!

l3nkz avatar Aug 04 '20 11:08 l3nkz

https://github.com/Anakael/Waybar/tree/workspace-manager-implementation branch for tracking implementation

Anakael avatar Aug 04 '20 23:08 Anakael

https://github.com/Anakael/Waybar/tree/workspace-manager-implementation branch for tracking implementation

I really don't mess high-level WorkspaceManager with wlr C code. Any ideas how to separate them?

Anakael avatar Aug 04 '20 23:08 Anakael

No, that's the ugly life of a C++ programmer working with C interfaces. What you did is basically what I usually also do. Have some very small static C-style functions that are used as callbacks for the C interface. These C-style functions only do one thing, call the proper C++ member function.

l3nkz avatar Aug 05 '20 04:08 l3nkz

No, that's the ugly life of a C++ programmer working with C interfaces. What you did is basically what I usually also do. Have some very small static C-style functions that are used as callbacks for the C interface. These C-style functions only do one thing, call the proper C++ member function.

Yeah, but there are (about FTM) half of file such small functions and bindings and it's become harder to read high-level taskbar API. I think about additional abstract layer as controller who create manager and bind C to C++.

Anakael avatar Aug 05 '20 05:08 Anakael

Yeah, but there are (about FTM) half of file such small functions and bindings and it's become harder to read high-level taskbar API. I think about additional abstract layer as controller who create manager and bind C to C++.

I don't think this is worth the effort. You will probably end up with more code doing exactly the same thing, which in the end will be even worse to read.

l3nkz avatar Aug 05 '20 05:08 l3nkz

https://github.com/Alexays/Waybar/pull/805 Done.

Anakael avatar Aug 07 '20 21:08 Anakael

Any news about this? I would love this feature. I usually have dozens of windows open on multiple workspaces, and a taskbar is only useful if only the tasks on this workspace are shown :) Thank you for constantly adding great features!

AGCaesar avatar Dec 13 '20 22:12 AGCaesar

@AGCaesar The PRs and MRs to get the base workspace functionality working are still waiting to be merged. If they are merged another protocol PR is missing to know which toplevel (window) is on which workspace. Once this is also merged, we can move forward and implement this feature in waybar.

l3nkz avatar Dec 14 '20 06:12 l3nkz

Hello there, any news about this? I would like to have such option. Couldn't find a PR related to this.

mmequignon avatar Nov 09 '21 11:11 mmequignon

Hello there, any news about this? I would like to have such option. Couldn't find a PR related to this.

There are no PR for this feature yet. We are waiting for workspace protocol merging.

Anakael avatar Nov 09 '21 12:11 Anakael

Hello there, any news about this? I would like to have such option. Couldn't find a PR related to this.

There are no PR for this feature yet. We are waiting for workspace protocol merging.

Can I help in some way?

mmequignon avatar Nov 09 '21 15:11 mmequignon

Probably not. We have to be patient and wait for the upstream developers to have a proper look at the PRs so that they can be merged or improved if necessary.

l3nkz avatar Nov 11 '21 08:11 l3nkz

Hi, any news about that? Sounds like a must-have. . .

Okanda avatar Jul 05 '22 09:07 Okanda