-
Notifications
You must be signed in to change notification settings - Fork 17
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
Initial implementation of cosmic-workspace-unstable-v1 #212
Conversation
Nice! I'm travelling right now, but will try to review these in detail on
Monday. At the first glance it looks good. I wonder if it's worth it to add
pointer to api specific data in workspace_t structure and put cosmic
specific flags in there to avoid iterating across two lists for every
callback.
…On Fri, 26 Jul 2024, 02:53 Consolatis, ***@***.***> wrote:
This is a partial implementation of the cosmic-workspace-unstable-v1
<https://github.com/pop-os/cosmic-protocols/blob/9c41b6b0ece1672c335e59bf670f8671ce66ed33/unstable/cosmic-workspace-unstable-v1.xml>
,
It allows to list the compositor workspaces including their state (being
active or not) and to select the active workspace.
The protocol itself also allows to configure workspaces (create and
remove) which is not implemented here (nor in labwc).
Some more caveats:
- workspace coordinates are not handled
- there is a hidden and urgent state per workspace that isn't handled
in this PR
- workspace groups are completely ignored in this PR, only the
workspaces themselves are shown
- the output_enter and output_leave group events are not handled in
this PR
Most of the above are due to me not being versed enough in the sfwbar
internals and thus not sure how to hook them up without complicating the
other IPC systems.
This PR is based on top of #211
<#211>, will rebase once that one
is merged.
The codestyle in cosmic-workspaces.c is using tabs, I am completely fine
adjusting that if it matters.
There is a labwc draft PR to test against:
- labwc/labwc#2030 <labwc/labwc#2030>
Alternatively testing against cosmic itself should hopefully also work but
I didn't test that at all.
------------------------------
You can view, comment on, or merge this pull request online at:
#212
Commit Summary
- 9867e4c
<9867e4c>
wayland: verify versions for foreign-toplevel and xdg-output
- 9ec7a9a
<9ec7a9a>
wayland/ipc.c: use single entry point for IPC
- 7a70cda
<7a70cda>
workspaces: add _supported() and _set_name()
- 6aa2964
<6aa2964>
wayland/cosmic-workspaces: initial implementation
File Changes
(10 files <https://github.com/LBCrion/sfwbar/pull/212/files>)
- *M* meson.build
<https://github.com/LBCrion/sfwbar/pull/212/files#diff-30d8f6be6320feeacf686be94f48c70869b52630e01ea625f0f15adc0d57c3e4>
(5)
- *A* protocols/cosmic-workspace-unstable-v1.xml
<https://github.com/LBCrion/sfwbar/pull/212/files#diff-2a60adebddb2a015464cc4216ad4e8210acb34da3e2e4b04c64c9dd1941ee092>
(364)
- *M* src/pager.c
<https://github.com/LBCrion/sfwbar/pull/212/files#diff-6d87938959aa1c2250a35c81e9d03da2a2acb0497c009686c69ce65edf77a213>
(5)
- *M* src/wayland.c
<https://github.com/LBCrion/sfwbar/pull/212/files#diff-959d4c490756bcdda6e735a9cb03e72f9413a581f08d3ef4019638000f0d10bb>
(4)
- *A* src/wayland/cosmic-workspaces.c
<https://github.com/LBCrion/sfwbar/pull/212/files#diff-0970758c800c62d24c0a4221dcc88a3e8c54df3f4689f57973562e76934fd1cc>
(291)
- *M* src/wayland/foreign-toplevel.c
<https://github.com/LBCrion/sfwbar/pull/212/files#diff-2fc490bb574e7564815a1b1ad108844ad00ca6b7a9a7f42b9f3b3ab474800a13>
(45)
- *A* src/wayland/ipc.c
<https://github.com/LBCrion/sfwbar/pull/212/files#diff-031eb4162b0bd146c6702a9e1617812129d2a8c9e5933fa50704b76cfac9f888>
(50)
- *M* src/wayland/xdg-output.c
<https://github.com/LBCrion/sfwbar/pull/212/files#diff-09438c32df406b125bae0785d5aed6207815b924928bac6974da116b2b2c9f24>
(10)
- *M* src/workspace.c
<https://github.com/LBCrion/sfwbar/pull/212/files#diff-e63e1bd874d1b6c4ca58520709bdcc82e429e1d783234e1373060b498d43a8b0>
(15)
- *M* src/workspace.h
<https://github.com/LBCrion/sfwbar/pull/212/files#diff-020cf997f595820ea0a3774a476ece62390b73131fe80835e3b3f69cea92a916>
(3)
Patch Links:
- https://github.com/LBCrion/sfwbar/pull/212.patch
- https://github.com/LBCrion/sfwbar/pull/212.diff
—
Reply to this email directly, view it on GitHub
<#212>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASHPFFGYF6QMV6QZ55WKTM3ZOGTY7AVCNFSM6AAAAABLPT3IWWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQZTCMRVHA2DCMQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
This seems to work great! When I get time I'll stuff around with the widget to get it looking nice :) Thanks @Consolatis for pursuing this! |
Screeny labwc/labwc#2030 (comment) |
Apologies for starting with pedantic stuff - ident formatting. I am looking at the substance as well :) |
I think this isn't working @LBCrion after your latest commit to @Consolatis PR
to restrict the width. On the plus side this works great in labwc/rc.xml
except they are sorted alphabetically. |
Tweaked config recording.mp4 |
Do you mean the title_width property isn't working for the taskbar? The PR should have no impact on this. Does it work with beta15?
You should be able to add |
@Consolatis, are there any plans to implement Also, is there a way to rename a workspace on the fly? I would like to test the handling of workspace/pin name collision scenario. |
No immediate plans at least. This is something that might be implemented in labwc at some point as the ability to create / rename / delete workspaces is already available within labwc itself (and cosmic workspaces should already mirror these changes).
Version 2 of the protocol added a rename action and corresponding capability. |
I've added a commit to the labwc draft PR which allows for creating workspaces. Note that it will be reverted before merging and is not a complete implementation (e.g. once you |
…ion of new states, cosmic-workspaces: handle workspace creation correctly.
Thank you, I got the creation working correctly now. Is the idea for the stable implementation for now to only support workspace definition changes via Reconfigure, Since any changes from other sources would need to be reconciled vs the config? It would probably be cleanest to disable to pins until dynamic workspace creation is supported. I think on sfwbar side, I may introduce a corresponding capability and only display pins if it's enabled. |
Yes, that is the main stopper for labwc in regards to workspace creation. |
I think I finally got this PR into state that's ready for merging. @Consolatis, I would appreciate if you could review it to see if I missed / screwed up anything. @01micko, if you get a chance to test the latest version of this PR, it would be much appreciated. |
Will do during the week, thanks for your constant work on sfwbar, really appreciate your dedication. |
Thanks guys for the great efforts put into this! On initial look it works great - both labwc (20 mins ago so latest wip/cosmic_wokspaces) and sfwbar on latest commits. The 'pins' issue is solved. Couple of warnings on start up with bone stock config:
I also have a vertical config I've been testing and that works best with this in <desktops>
<popupTime>1000</popupTime>
<names>
<name>1</name>
<name>2</name>
<name>3</name>
<name>4</name>
</names>
</desktops> The only warnings I get with that is widget conflicts - so my problem. Which brings me to the UX
Many thanks @Consolatis and @LBCrion 😄 |
Vertical demo vert.mp4 |
Using either unicode symbols or emoticons might also work, e.g. something like <desktops>
<names>
<name>💻</name>
<name>📺</name>
<name>📜</name>
</names>
</desktops> |
I didn't realise it wan't part of the stock config! Sorry about that noise. All works as expected with |
Translations do survive. Tested with es_ES locale. |
These should hopefully be fixed in the main branch now. |
Sorry, took a bit longer to come back to this PR. From the protocol perspective all changes look fine to me. Regarding the path forward, labwc will have a release around Aug. 16th (without cosmic-workspace support) and will then likely merge the server side implementation in its master branch shortly after that. Obviously completely up to you if you want to sync it up with labwc or merge this PR before / after. There might be some more minor changes on the labwc side of the PR but nothing that would change anything regarding the protocol. |
No problem at all. I made a few more small changes in the meantime - namely added an invalid state to avoid updating pager items more often than needed (updating gtk widgets is relatively cpu intensive). |
One more thing I had on my mind that would be relevant to this PR is handling of wayland globals. Currently sfwbar registers multiple global handlers in order to enforce the priority of protocols. I think it would be cleaner to get a list of interfaces available and then bind to them if and when necessary (I think we'll need to do this if we implement cosmic workspaces and then need to decide if we want to bind to this interface or to ext-workspaces once that's avaible). My thinking so far is to do the following:
The question is, can we be confident that all the interfaces will be advertised on the first roundtrip and is there a chance of them going away in the future before we can bind to them? |
Yes, I think so. It is already the case with outputs but technically compositors can remove ( Edit:
Not sure how to react to further |
I added the interface storage list and updated all protocol implementation to use it in this PR. It seems to work well and should allow to mediate between ext-workspaces and cosmic-workspaces in the future. |
Thanks for merging and all your improvements over the initial PR! |
This is a partial implementation of the cosmic-workspace-unstable-v1 protocol,
I finally have decided to not wait another 3 years until the official workspace protocol is accepted. This goes very much against my own believes that labwc should only use wlroots or wayland protocols but version 1 of the cosmic-workspaces protocol is basically the same as what is proposed in the upstream protocol. Using the cosmic variant also allows using the protocol without hiding it behind feature flags as the upstream protocol may change in incompatible ways before being accepted.
This PR allows to list the compositor workspaces including their state (being active or not) and to select the active workspace.
The protocol itself also allows to configure workspaces (create and remove) which is not implemented here (nor in labwc).
Some more caveats:
hidden
andurgent
state per workspace that isn't handled in this PRoutput_enter
andoutput_leave
group events are not handled in this PRMost of the above are due to me not being versed enough in the sfwbar internals and thus not sure how to hook them up without complicating the other IPC systems.
This PR is based on top of #211, will rebase once that one is merged.
The codestyle in
cosmic-workspaces.c
is using tabs, I am completely fine adjusting that if it matters.There is a labwc draft PR to test against:
Alternatively testing against cosmic itself should hopefully also work but I didn't try that at all.