Artix Linux Forum

General Category => General Discussion => Topic started by: phoenix_king_rus on 30 May 2025, 19:18:07

Title: Is there a way to implement systray in wayland w/o dbus?
Post by: phoenix_king_rus on 30 May 2025, 19:18:07
So, since mesa deprecated gallium-xa which means that X may be destroyed any time soon, i've started digging whether i can reproduce my X setup on wayland. As a dwm user, i find dwl (https://codeberg.org/dwl/dwl) to be the closest option. However, there are some options it neither provids itself, nor do currently submitted patches (https://codeberg.org/dwl/dwl-patches). For me those are:
1) systray
2) keyboard layout display
3) list of windows on active tag
While, i suppose, i could deal with 2 and 3 myself, the only systray implementation is via bar-systray patch (https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/bar-systray). However, the latter makes dbus a heavy requirement for starting dwl which i don't like at all. Therefore, i ask, does anyone know any wayland systray implementations which do not require dbus session to be active?
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: clappingsnowdrop on 31 May 2025, 14:39:23
I'm a dwl user too (with yambar as status bar).

I've no answer for the title in question as that's out of my depth. I've only have a elogind free setup. I haven't delved into dbus.

If starting dwl with dbus is the issue. Would having a status bar (waybar) that depends on libelogind (which depends on dbus) without launching dbus be fine? (Note: I haven't tried this nor am I certain that this will work.)

My previous setup was sway + waybar. I haven't tried dwl + waybar.

Not really the answer you're looking for. I'm just laying out ideas.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: phoenix_king_rus on 01 June 2025, 07:45:10
Would having a status bar (waybar) that depends on libelogind (which depends on dbus) without launching dbus be fine?
Looking through waybar code was the first idea i had. Starting from systray.cpp, it didn't take me 3 minutes of just opening include files to find dbus header used.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: mrbrklyn on 01 June 2025, 08:11:39
Would having a status bar (waybar) that depends on libelogind (which depends on dbus) without launching dbus be fine?
Looking through waybar code was the first idea i had. Starting from systray.cpp, it didn't take me 3 minutes of just opening include files to find dbus header used.


I am listening to see what I can learn here, so excuse me for what might sound confused.  But if you have a system tray, you will need some form of inter-process communication?  Am I wrong?  Is that not the primary purpose of a system tray?
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: phoenix_king_rus on 01 June 2025, 08:52:36
But if you have a system tray, you will need some form of inter-process communication? Is that not the primary purpose of a system tray?
Good question. AFAIK there are some built-in wayland ipc mechnisms, as well as dwl-specific ipc (the latter however does not support any systray-related info by default).
The reason why i question in the first place is that there is a systray patch for dwm which does not require dbus at all. Maybe it is some Xorg-specific magic that cannot be implemented in wayland. Maybe not. That's why i ask.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: gripped on 01 June 2025, 11:16:11
I think you are out of luck if you want to avoid dbus.
The reason why i question in the first place is that there is a systray patch for dwm which does not require dbus at all. Maybe it is some Xorg-specific magic that cannot be implemented in wayland. Maybe not. That's why i ask.
It is X specific
https://specifications.freedesktop.org/systemtray-spec/0.3/  (XEmbed system tray spec) is what dwm is using.
All the solutions to embed XEmbed tray icons in wayland's SNI (StatusNotifierItem) systrays use dbus AFAIK. As programs can't directly communicate with, or control, each other on wayland by design.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: phoenix_king_rus on 01 June 2025, 12:34:46
As programs can't directly communicate with, or control, each other on wayland by design.
Shame. I hoped, there could exist a way based on wayland client<->compositor ipc
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: clappingsnowdrop on 01 June 2025, 12:51:34
A different alternative would be to directly code it in a status bar. Although it would most likely still need dbus (or libdbus for a soystemd-free alternative than sd-dbus. Check link below.).

I'm not sure what's you're reasoning for not using dbus, but I think I can assume it's because of soystemd. Being in Artix forums
as well as it reminded me of this post from a yambar pull request of wanting to implement a Icon & Tray support:
https://codeberg.org/dnkl/yambar/pulls/324

Note: yambar has ended development last month ago. But I think that pull request discussion can also offer some insight, and maybe inspiration for your code should you plan to do a diy solution.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: phoenix_king_rus on 01 June 2025, 13:32:49
A different alternative would be to directly code it in a status bar.
The problem is not about where to do it, but how

I'm not sure what's you're reasoning for not using dbus, but I think I can assume it's because of soystemd.
I don't like to be forced to use dbus for desktop to be functional. Although i currently start dwm inside dbus session, i can safely start it w/o dbus and all i lose would be some fancy integration which isn't critical for me. That's what i want from wayland, and looks like i'm not getting it.

However, briefly reading about wayland api, i found wl_data_source / wl_data_offer pair of functions. If those can be used to get information about incoming mesages/emails from respective apps, it would be fine for me. I suppose, GUI for clipboard manager can be implemented separately w/o using systray.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: clappingsnowdrop on 01 June 2025, 13:53:47
A different alternative would be to directly code it in a status bar.
The problem is not about where to do it, but how

I'm not sure what's you're reasoning for not using dbus, but I think I can assume it's because of soystemd.
I don't like to be forced to use dbus for desktop to be functional. Although i currently start dwm inside dbus session, i can safely start it w/o dbus and all i lose would be some fancy integration which isn't critical for me. That's what i want from wayland, and looks like i'm not getting it.

However, briefly reading about wayland api, i found wl_data_source / wl_data_offer pair of functions. If those can be used to get information about incoming mesages/emails from respective apps, it would be fine for me. I suppose, GUI for clipboard manager can be implemented separately w/o using systray.

I see so my assumption was wrong. The issue was is having dbus(likely including libdbus) in general (which probably means the link I gave was pointless). Yeah, unfortunately seems like there's no other way (that I now of).

As for the wayland api, that's out of my depth. Same goes for the GUI clipboard manager.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: mrbrklyn on 02 June 2025, 00:21:47
As programs can't directly communicate with, or control, each other on wayland by design.



To me, this just sounds like another reason not to have wayland.  Why is this watered down, feature deficient software being forced on the community.  For a new thing, it is a major step backwards and devoid of anything modern or particularly useful.  It is neutered.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: gripped on 02 June 2025, 00:39:45
To me, this just sounds like another reason not to have wayland.  Why is this watered down, feature deficient software being forced on the community.  For a new thing, it is a major step backwards and devoid of anything modern or particularly useful.  It is neutered.
I completely agree.
16 years old now and still doesn't work. In my most humble opinion.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: mrbrklyn on 02 June 2025, 14:42:13
To me, this just sounds like another reason not to have wayland.  Why is this watered down, feature deficient software being forced on the community.  For a new thing, it is a major step backwards and devoid of anything modern or particularly useful.  It is neutered.
I completely agree.
16 years old now and still doesn't work. In my most humble opinion.


Consider that X was written by a few MIT undergrads in there spare time
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: phoenix_king_rus on 02 June 2025, 20:09:02
I got an idea which could probably partially resolve the issue, at least for me: if there is a way to get icon of the application and this icon is changed on some events (new messages/emails), then a section with these icons would effectively replace systray for me. Since i target dwl, i could use already established rules mechanism to filter only those apps i really need in tray.
The major issue, however, is to get icon of given client
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: mrbrklyn on 02 June 2025, 21:00:48
I got an idea which could probably partially resolve the issue, at least for me: if there is a way to get icon of the application and this icon is changed on some events (new messages/emails), then a section with these icons would effectively replace systray for me. Since i target dwl, i could use already established rules mechanism to filter only those apps i really need in tray.
The major issue, however, is to get icon of given client


That is exactly what window maker originally did.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: rayburn on 02 June 2025, 21:24:49
To me, this just sounds like another reason not to have wayland.  Why is this watered down, feature deficient software being forced on the community.  For a new thing, it is a major step backwards and devoid of anything modern or particularly useful.  It is neutered.
I completely agree.
16 years old now and still doesn't work. In my most humble opinion.

I am holding out and using X as long as it is possible. 16 years and still not ready is quite honestly a joke.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: gripped on 02 June 2025, 22:23:19
I am holding out and using X as long as it is possible. 16 years and still not ready is quite honestly a joke.
I see wayland as a slight drift towards the IOSification of Linux. "Lock it all down, The users can't be trusted"
Can't do this, can't do that. "Security!" so important that things you can do easily in X are either impossible in wayland or need shims and/or proxies to function on wayland.
Along with the KDE insistence that you can't run Dolphin or Kate as root unless you patch them (I do).

As far as I'm concerned if malware has managed to run as my user I've already lost and having it snoop on X programs makes little difference.

I try wayland now and then just to remind myself why I don't want to use it.
I used to worry that X would cease to be but I don't think it's happening for a long time now.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: phoenix_king_rus on 03 June 2025, 07:57:00
I see wayland as a slight drift towards the IOSification of Linux. "Lock it all down, The users can't be trusted"
Can't do this, can't do that. "Security!" so important that things you can do easily in X are either impossible in wayland or need shims and/or proxies to function on wayland.
And then they say `dbus`

I try wayland now and then just to remind myself why I don't want to use it.
I used to worry that X would cease to be but I don't think it's happening for a long time now.
I can only hope on that. But the deprecation from mesa is worrying af

There is however just one thing in wayland which i liked: nested compositors. It's similar to XEmbed but isn't a separate protocol which application has to support. As zathura started to work bad with tabbed several versions ago, this could be a solution. And you don't actually need to run wayland session to use it, it can be run from X as well.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: mrbrklyn on 03 June 2025, 09:43:53
This is all stressing me out.  I look at all of this and I wonder where our future is.  We are increasingly dependent on these digital devices for day to day living and they are increasingly out of our control, insecure and beyond private ownership.  40 years almost of promoting Free software and it all seems to be a colossal bust.

And then Pottering et al can't understand why the reaction to systemd was so virulent.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: artoo on 03 June 2025, 09:54:37
Honestly, trying to have a desktop without all the dbus, *kits, logind and other stuff from freedesktop, well, that train has left the station years ago. It already has become hard to impossible to remove it. It is in my view a lost battle to fight, all that can be done is hold out in a niche fringe corner. That said, I haven't liked the desktop direction linux took for years.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: phoenix_king_rus on 03 June 2025, 10:07:07
Honestly, trying to have a desktop without all the dbus, *kits, logind and other stuff from freedesktop, well, that train has left the station years ago.
Aren't we here to show they're wrong? Init, logind and udev parts of systemd can be replaced while keeping most of the system operational. The system loses a bit of fancy stuff, but functionality does not suffer much usually. Dbus is perhaps the most complicated to get rid of, but that's not impossible. Depends on what fancyness you are ready to trade off (like systray i mentioned), but still keeps system operational.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: artoo on 03 June 2025, 10:43:47
Honestly, trying to have a desktop without all the dbus, *kits, logind and other stuff from freedesktop, well, that train has left the station years ago.
Aren't we here to show they're wrong? Init, logind and udev parts of systemd can be replaced while keeping most of the system operational. The system loses a bit of fancy stuff, but functionality does not suffer much usually. Dbus is perhaps the most complicated to get rid of, but that's not impossible. Depends on what fancyness you are ready to trade off (like systray i mentioned), but still keeps system operational.


I am way past to point trying to smash my head through a brickwall.
Its fine people try to remove every last component, but in actual terms, any major desktop becomes sort of second class citizen if you remove it all. These work only partially without all the stuff.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: mrbrklyn on 03 June 2025, 10:50:42
Honestly, trying to have a desktop without all the dbus, *kits, logind and other stuff from freedesktop, well, that train has left the station years ago. It already has become hard to impossible to remove it. It is in my view a lost battle to fight, all that can be done is hold out in a niche fringe corner. That said, I haven't liked the desktop direction linux took for years.


I don't think it is really a bad idea to have a univeral IPC mechanism such as dbus, but in this case, they are stripping X of its inherent ability to do this and forcing the crippleware on the public in the form of wayland.  What really angers me is the stripping of networking from the interface.  X11 could run a program from anywhere in the world and display it like it is a local application.   That is a powerful tool that has not nearly been exploited enough.  Instead of using X we are trying to stuff everything through a browser and with jsom.  That is increasing security?  I think not.

Imagine running your banking ap by making an ssh connection directly to the banks infrastructure and remotely running the backing program ON THERE server and displaying it on your client box.  Not only is that more secure, but there is nothing to install on the  client box.  It is running on the server in real time.

My kids used to do this all the time, and play the game crossfire off my main workstation from their bedrooms. 
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: artoo on 03 June 2025, 10:58:40
Honestly, trying to have a desktop without all the dbus, *kits, logind and other stuff from freedesktop, well, that train has left the station years ago. It already has become hard to impossible to remove it. It is in my view a lost battle to fight, all that can be done is hold out in a niche fringe corner. That said, I haven't liked the desktop direction linux took for years.


I don't think it is really a bad idea to have a univeral IPC mechanism such as dbus, but in this case, they are stripping X of its inherent ability to do this and forcing the crippleware on the public in the form of wayland.  What really angers me is the stripping of networking from the interface.  X11 could run a program from anywhere in the world and display it like it is a local application.   That is a powerful tool that has not nearly been exploited enough.  Instead of using X we are trying to stuff everything through a browser and with jsom.  That is increasing security?  I think not.

X has its very own design flaws, and I agree with the general idea to replace X with something that doesn't have these flaws. But thats where the common ground with wayland ends.
A dbus IPC like thing is also not a bad idea, and I don't know if people know what a disaster kdbus had been if it would have been implemented upstream in kernel. Luckily, it was refused.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: lotuskip on 03 June 2025, 11:05:59
A dbus IPC like thing is also not a bad idea, and I don't know if people know what a disaster kdbus had been if it would have been implemented upstream in kernel. Luckily, it was refused.
Back in the day when they were pushing for kdbus, someone in the Gentoo forums was arguing that everything dbus does could be accomplished more reasonably using TIPC, which already existed (and still does) in the kernel. Now, I don't really know anything about TIPC, but the claim that the creators of (k)dbus were just reinventing something poorly sounds quite plausible.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: replabrobin on 03 June 2025, 11:22:38
according to https://docs.kernel.org/networking/tipc.html TIPC is network oriented so probably not the same as d-bus in scope.
Title: Re: Is there a way to implement systray in wayland w/o dbus?
Post by: mrbrklyn on 03 June 2025, 17:04:15
according to https://docs.kernel.org/networking/tipc.html TIPC is network oriented so probably not the same as d-bus in scope.


Quote
Have you ever wished you had the convenience of Unix Domain Sockets even when transmitting data between cluster nodes?

That is interesting for clusters... not much of anything for a stand alone system.

I will note though that UDS Unix Domain Sockets is a built in kernel level means of IPC.

https://thelinuxcode.com/unix-domain-socket-usage/

https://www.baeldung.com/linux/unix-domain-socket-create

I have no doubt that the Free Desktop crazies just love to reinvent the wheel and move kernel space activities to users space,

FWIW

https://discourse.flathub.org/t/what-does-finish-args-x11-without-ipc-mean-and-how-do-you-fix-it/3279

https://www.x.org/wiki/guide/communication/