0

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?

FluffyDango
  • 133
  • 9

2 Answers2

1

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.

Uli Schlachter
  • 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
0

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

Uli Schlachter
  • 9,337
  • 1
  • 23
  • 39