Skip to content

Global menu support (via IPC)#2959

Merged
ammen99 merged 5 commits intoWayfireWM:masterfrom
dkondor:global_menu_ipc
Jan 24, 2026
Merged

Global menu support (via IPC)#2959
ammen99 merged 5 commits intoWayfireWM:masterfrom
dkondor:global_menu_ipc

Conversation

@dkondor
Copy link
Contributor

@dkondor dkondor commented Jan 17, 2026

This is an alternative to #2576 that does not require any new Wayland protocol, so can be deployed as is. The downside is that the client displaying the global menus will need to use Wayfire's IPC as well, so will need a specialized implementation.

Note: currently, how this works is that the IPC plugins sends out the set of DBus properties whenever sending information about a view. This could be optimized by having a separate event for it, since these are not expected to change.

A simple test client is available here: https://github.com/dkondor/gtk_global_menu with basic instructions on how to make things work.

My medium-term plan is to add support in Cairo-Dock (although the Global-Menu plugin is still considered unstable and actually does not provide a nice user experience) which should be very easy to do. I might also look into creating a very simple layer-shell client that actually displays a menu bar (however, that might need something like what you did for wf-shell here to translate the dbusmenu objects to a menu model).

@soreau
Copy link
Member

soreau commented Jan 18, 2026

My medium-term plan is to add support in Cairo-Dock

Hi @dkondor, this sounds great! Regarding cairo-dock specifically though, some folks on chat have wondered about cairo-dock and while I know you have it working, I do not know which repos or branches you use for it. So, can you please say which cairo-dock repos and branches you use to have the 'best' cairo-dock experience on wayfire?

@dkondor
Copy link
Contributor Author

dkondor commented Jan 18, 2026

My medium-term plan is to add support in Cairo-Dock

Hi @dkondor, this sounds great! Regarding cairo-dock specifically though, some folks on chat have wondered about cairo-dock and while I know you have it working, I do not know which repos or branches you use for it. So, can you please say which cairo-dock repos and branches you use to have the 'best' cairo-dock experience on wayfire?

My changes have been merged upstream, so it is best to use the official repositories:
https://github.com/Cairo-Dock/cairo-dock-core
https://github.com/Cairo-Dock/cairo-dock-plug-ins

@Secret-chest
Copy link
Contributor

If this is added, I will support it in Panorama.

@ammen99
Copy link
Member

ammen99 commented Jan 19, 2026

@dkondor I don't think we should add all possible properties in view_to_json. The information from there is used in pretty much every IPC event, and for the vast majority of IPC clients that information will be useless.

There is a recent support for view properties, introduced in this PR: #2835 . I believe properties are a better fit for this use-case. You can set properties without a custom_data (so it eliminates the need for headers), and there are already IPC methods for querying view properties. If performance is an issue (since we have multiple properties here), I suppose we could extend the get-property IPC method to also support querying multiple properties at once. But I suppose we could try to query them one by one, and then if performance is really an issue, think about speeding it up.

@dkondor
Copy link
Contributor Author

dkondor commented Jan 19, 2026

Hi,
thanks, I wasn't aware of the possibility of getting properties via IPC, that sounds like a good solution. I'll try to adjust accordingly.

@dkondor
Copy link
Contributor Author

dkondor commented Jan 20, 2026

Hi,

I've updated the PR using properties as suggested + updated the example code: https://github.com/dkondor/gtk_global_menu/ -- now it includes a very minimal client that actually displays a menu bar.

The only things that I could not figure out is whether it is possible to remove properties -- did I miss something? (Although in practice, it is not expected that clients remove these properties, so this is likely not an issue; note: the code style check is probably failing due to the TODO comment I left in there about this)

@ammen99
Copy link
Member

ammen99 commented Jan 20, 2026

Hi,

I've updated the PR using properties as suggested + updated the example code: https://github.com/dkondor/gtk_global_menu/ -- now it includes a very minimal client that actually displays a menu bar.

The only things that I could not figure out is whether it is possible to remove properties -- did I miss something? (Although in practice, it is not expected that clients remove these properties, so this is likely not an issue; note: the code style check is probably failing due to the TODO comment I left in there about this)

There is no way to remove properties currently, but it should be easy to add a new method for this purpose.

@dkondor
Copy link
Contributor Author

dkondor commented Jan 21, 2026

Looking at the code again, now I've realized that I could just use the erase_data function to delete a property :)

@ammen99 do you still prefer to add a separate, erase_property() function for clarity? (that just calls erase_data())

@ammen99
Copy link
Member

ammen99 commented Jan 21, 2026

Looking at the code again, now I've realized that I could just use the erase_data function to delete a property :)

@ammen99 do you still prefer to add a separate, erase_property() function for clarity? (that just calls erase_data())

Yes, I that would be better.

Copy link
Member

@ammen99 ammen99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we can merge after you add a method to delete properties (I assume you plan to do it?)

This allows apps to link their implementation of the com.canonical.dbusmenu DBus interface to their open views, implementing global menus.
This allows relaying these to clients
@dkondor
Copy link
Contributor Author

dkondor commented Jan 21, 2026

LGTM, we can merge after you add a method to delete properties (I assume you plan to do it?)

OK, done!

@dkondor dkondor marked this pull request as draft January 21, 2026 19:42
@dkondor
Copy link
Contributor Author

dkondor commented Jan 21, 2026

Just one more thing -- I've just noticed there is a capabilities event in the gtk-shell protocol which may be relevant.

This will trigger GTK3 apps to export their menus via DBus.
@dkondor dkondor marked this pull request as ready for review January 21, 2026 20:20
@dkondor
Copy link
Contributor Author

dkondor commented Jan 21, 2026

Just one more thing -- I've just noticed there is a capabilities event in the gtk-shell protocol which may be relevant.

OK, so apparently sending this event with the "global_menu_bar" value included will trigger GTK3 apps to export their menus via DBus, regardless of whether the appmenu-gtk-module is loaded. So I think it can be useful to optionally advertise it -- I've added a setting for it.

@dkondor
Copy link
Contributor Author

dkondor commented Jan 21, 2026

Fixes #2367 (I already forgot about it)

@ammen99
Copy link
Member

ammen99 commented Jan 24, 2026

@dkondor The API/ABI change is bumped essentially every time I change something in the headers. It helps plugins also keep track of Wayfire's API if they want to.

Copy link
Member

@ammen99 ammen99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ammen99 ammen99 merged commit 209ab88 into WayfireWM:master Jan 24, 2026
4 checks passed
@dkondor dkondor deleted the global_menu_ipc branch January 25, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants