I want to add a battery widget to the systray. How can I do that? How does systray recognize what programs to put in it?
2 Answers
It just occurred to me that this question has the awesome-wm
tag, so ignore my X11-answer. Here is another attempt.
There is no way to add anything to a wibox.widget.systray
from Lua code. However, you could just put a awful.widget.imagebox
or awful.widget.button
next to the systray in your wibar. I think that having another widget next to the systray like this should look just as if there was another entry in the systray.

- 9,337
- 1
- 23
- 39
-
Yes, that's probably what I will end up doing since it's too much of a hassle. The reason I wanted to add it to the systray is to keep it organized in one place. Thank you nonetheless. – FluffyDango Apr 16 '22 at 16:12
It's a protocol. It's complicated. I really think that: No, you do not want to do it yourself.
Anyway, here is the specification: https://specifications.freedesktop.org/systemtray-spec/systemtray-spec-0.2.html
How does systray recognize what programs to put in it?
The tray icon (=the program you want to write) locates the tray manager (see section Locating the system tray
) and then requests to be docked (see section Docking a try icon
). For this, it creates a window and this window will then be added to the system tray.
Since the above mentions XEmbed, here is its spec: https://specifications.freedesktop.org/xembed-spec/xembed-spec-latest.html

- 9,337
- 1
- 23
- 39