Skip to content

Use libdbus for trays on Linux instead of Ayatana and GTK - #14582

Closed
eafton wants to merge 20 commits into
libsdl-org:mainfrom
eafton:tray-dbus
Closed

Use libdbus for trays on Linux instead of Ayatana and GTK#14582
eafton wants to merge 20 commits into
libsdl-org:mainfrom
eafton:tray-dbus

Conversation

@eafton

@eafton eafton commented Dec 3, 2025

Copy link
Copy Markdown
Contributor

WIP implementation of a pure libdbus tray implementation, should close #13666, #11703 and Taiko2k/Tauon#1772.

Notes:
-Some of the menu interfaces are unimplemented for now.
-Tray creation, icon/tooltip setting works properly.
-Menu export and callbacks are working.
-DestroyTray does not clean up memory for menus and entries.
-Various TODOs in the code are present.
-Canonical's protocol is used for menu export, the GIO menu protocol is unsupported.
-Currently there is no support for the old XEmbed tray protocol, that will come once more "toolkit" functionality (see #14395) gets implemented. Functionality for having multiple tray drivers is already implemented.
-Tooltips are supported unlike the old Ayatana implementation.

image

@ssokolow @smcv @slouken

@eafton
eafton marked this pull request as draft December 3, 2025 19:17
@sezero

sezero commented Dec 3, 2025

Copy link
Copy Markdown
Contributor

Whitespace and style changes are making it difficult to read the actual changes.

Tiny patch to make it build on alder systems:

diff --git a/src/core/linux/SDL_dbus.h b/src/core/linux/SDL_dbus.h
index 738fc06..27dcd41 100644
--- a/src/core/linux/SDL_dbus.h
+++ b/src/core/linux/SDL_dbus.h
@@ -38,6 +38,9 @@
 #ifndef DBUS_TYPE_UNIX_FD
 #define DBUS_TYPE_UNIX_FD ((int)'h')
 #endif
+#ifndef DBUS_ERROR_UNKNOWN_PROPERTY
+#define DBUS_ERROR_UNKNOWN_PROPERTY "org.freedesktop.DBus.Error.UnknownProperty"
+#endif
 
 typedef struct SDL_DBusContext
 {

@eafton

eafton commented Dec 3, 2025

Copy link
Copy Markdown
Contributor Author
+#ifndef DBUS_ERROR_UNKNOWN_PROPERTY
+#define DBUS_ERROR_UNKNOWN_PROPERTY "org.freedesktop.DBus.Error.UnknownProperty"
+#endif

Implemented.

@eafton

eafton commented Dec 4, 2025

Copy link
Copy Markdown
Contributor Author

Menu export works now, I just gotta wire it up.

image

Comment thread src/core/linux/SDL_dbus.c
Comment thread src/core/linux/SDL_dbus.c
@C0rn3j

C0rn3j commented Dec 6, 2025

Copy link
Copy Markdown

Will this implementation count with being able to use scroll events?

Currently we use it to set volume up/down based on scroll up/down over the tray (albeit the support for that in the current tray ecosystem seems spotty).

https://github.com/Taiko2k/Tauon/blob/e943bef475eb555b6bd5769e02ec7f11f80d2d54/src/tauon/t_modules/t_dbus.py#L269-L289

@ssokolow

ssokolow commented Dec 6, 2025

Copy link
Copy Markdown

If I'm understanding the SDL docs correctly, the SDL API having its guts rewritten currently only exposes the ability to define a context menu and set an icon and tooltip.

(Which matches what I'm seeing in the diff where a quick Ctrl+F shows no mention of the D-Bus SecondaryActivate or Scroll signals... SecondaryActivate being middle click under KDE.)

@eafton

eafton commented Dec 6, 2025

Copy link
Copy Markdown
Contributor Author

Will this implementation count with being able to use scroll events?

Currently we use it to set volume up/down based on scroll up/down over the tray (albeit the support for that in the current tray ecosystem seems spotty).

https://github.com/Taiko2k/Tauon/blob/e943bef475eb555b6bd5769e02ec7f11f80d2d54/src/tauon/t_modules/t_dbus.py#L269-L289

If the maintainers approve, we can add this.

@slouken

@slouken

slouken commented Dec 6, 2025

Copy link
Copy Markdown
Collaborator

Will this implementation count with being able to use scroll events?
Currently we use it to set volume up/down based on scroll up/down over the tray (albeit the support for that in the current tray ecosystem seems spotty).
https://github.com/Taiko2k/Tauon/blob/e943bef475eb555b6bd5769e02ec7f11f80d2d54/src/tauon/t_modules/t_dbus.py#L269-L289

If the maintainers approve, we can add this.

@slouken

Sure, we can add this. Go ahead and create a separate follow-on PR once this lands and include Windows support as well.

Thanks!

@C0rn3j

C0rn3j commented Dec 8, 2025

Copy link
Copy Markdown

Two more things that I can't seem to find in the current source, is it planned to:

  1. Be able to hide/show the icon without destroying it completely? AppIndicator has this option via set_status(0) and set_status(1) - https://lazka.github.io/pgi-docs/AyatanaAppIndicator3-0.1/classes/Indicator.html#AyatanaAppIndicator3.Indicator.set_status + https://lazka.github.io/pgi-docs/AyatanaAppIndicator3-0.1/enums.html#AyatanaAppIndicator3.IndicatorStatus

  2. Set icon description - this seems to be done for accessibility, unsure where/how it's actually used - https://lazka.github.io/pgi-docs/AyatanaAppIndicator3-0.1/classes/Indicator.html#AyatanaAppIndicator3.Indicator.set_icon_full

Thank you very much for working on this implementation!

@eafton

eafton commented Dec 9, 2025

Copy link
Copy Markdown
Contributor Author

Two more things that I can't seem to find in the current source, is it planned to:

  1. Be able to hide/show the icon without destroying it completely? AppIndicator has this option via set_status(0) and set_status(1) - https://lazka.github.io/pgi-docs/AyatanaAppIndicator3-0.1/classes/Indicator.html#AyatanaAppIndicator3.Indicator.set_status + https://lazka.github.io/pgi-docs/AyatanaAppIndicator3-0.1/enums.html#AyatanaAppIndicator3.IndicatorStatus
  2. Set icon description - this seems to be done for accessibility, unsure where/how it's actually used - https://lazka.github.io/pgi-docs/AyatanaAppIndicator3-0.1/classes/Indicator.html#AyatanaAppIndicator3.Indicator.set_icon_full

Thank you very much for working on this implementation!

What do you think? @slouken

@slouken

slouken commented Dec 9, 2025

Copy link
Copy Markdown
Collaborator

Two more things that I can't seem to find in the current source, is it planned to:

  1. Be able to hide/show the icon without destroying it completely? AppIndicator has this option via set_status(0) and set_status(1) - https://lazka.github.io/pgi-docs/AyatanaAppIndicator3-0.1/classes/Indicator.html#AyatanaAppIndicator3.Indicator.set_status + https://lazka.github.io/pgi-docs/AyatanaAppIndicator3-0.1/enums.html#AyatanaAppIndicator3.IndicatorStatus
  2. Set icon description - this seems to be done for accessibility, unsure where/how it's actually used - https://lazka.github.io/pgi-docs/AyatanaAppIndicator3-0.1/classes/Indicator.html#AyatanaAppIndicator3.Indicator.set_icon_full

Thank you very much for working on this implementation!

What do you think? @slouken

Typically we expose features in SDL that are available on multiple platforms. If this can be implemented on Windows, then it's fine to add. If it can't, we can discuss use cases and figure out if it makes sense to add it as a platform specific feature.

@eafton

eafton commented Feb 8, 2026

Copy link
Copy Markdown
Contributor Author

Closed, this will be reworked and a better PR will be opened soon.

@eafton eafton closed this Feb 8, 2026
@eafton
eafton deleted the tray-dbus branch March 9, 2026 12:09
@eafton
eafton restored the tray-dbus branch March 9, 2026 12:09
@C0rn3j

C0rn3j commented Mar 16, 2026

Copy link
Copy Markdown

New PR now over at #15189

@eafton
eafton deleted the tray-dbus branch April 12, 2026 08:28
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.

Pure DBus tray item implementation?

6 participants