awesomeWM / awesome

awesome window manager
https://awesomewm.org/
GNU General Public License v2.0
6.39k stars 597 forks source link

Feature Request: custom sorting for systray #3382

Open figsoda opened 3 years ago

figsoda commented 3 years ago

Currently wibox.widget.systray is sorted in chronological order (didn't read the code, but I think it is), it would be nice if I can sort it differently, e.g. alphabetically or dragging the icons around ~like you can do in a lot of desktop environments~.

psychon commented 3 years ago

alphabetically

Alphabetically by what? AFAIK, all we have is a window that we have to place somewhere. I doubt that any spec requires the window to have a WM_NAME or _NET_WM_NAME property. And even if there were such a requirement, I would still doubt that it is commonly implemented.

Huh, but it seems like at least Gtk3 does set properties on its tray icons:

$ xprop -id 0x3400002
XdndAware(ATOM) = BITMAP
GDK_TIMESTAMP_PROP(GDK_TIMESTAMP_PROP) = 0x61
_XEMBED_INFO(_XEMBED_INFO) = 0x1, 0x1
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 54525956, 54525957
_NET_WM_USER_TIME(CARDINAL) = 177422759
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x3400003
WM_CLIENT_LEADER(WINDOW): window id # 0x3400001
_NET_WM_PID(CARDINAL) = 91587
WM_LOCALE_NAME(STRING) = "de_DE.UTF-8"
WM_CLIENT_MACHINE(STRING) = "ZweiLED"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        program specified minimum size: 16 by 16
        program specified base size: 0 by 0
        window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "update-notifier.py", "Update-notifier.py"
WM_ICON_NAME(STRING) = "Updates Available"
_NET_WM_ICON_NAME(UTF8_STRING) = "Updates Available"
WM_NAME(STRING) = "Updates Available"
_NET_WM_NAME(UTF8_STRING) = "Updates Available"

or dragging the icons around like you can do in a lot of desktop environments.

Huh? I have to admit that this never occurred to me and so I never tried it, but still: Which DEs implement this?

figsoda commented 3 years ago

I don't remember what DE it is, maybe I remembered it wrong. Configuration can be a function that accepts properties of 2 icons and returns a boolean, or something like ordering-override.keyfile (I can't find the official docs) would be nice.

actionless commented 3 years ago

but indicator in unity is like widgets in awesome wm - you can change the order of them as well

never saw it implemented for legacy x11 tray but PRs are welcome

Elv13 commented 3 years ago

Some newer DE stopped caring about startup notification with the rise of Wayland. They now use SystemD CGroups to track from which origin a gui window comes from. Given the universe is going into that direction, while Linux only, we should (optionally) support it. That being said, I don't have that much time these days. It is on my list, but I am not sure I will ever get that far.

pushcx commented 2 years ago

Sorting stably by any property would be an improvement over chronological. Visually examining each icon in turn is a distraction.

psychon commented 2 years ago

@pushcx Any suggestions for what that property would be?

"Always present" would be the window id, but that is certainly not stable. Besides that, all the hints in https://specifications.freedesktop.org/systemtray-spec/systemtray-spec-0.3.html#hints have "should" requirements. So, there are no properties that are guaranteed to be available and stable. At least none that I can find.

actionless commented 2 years ago

@psychon i think just first try _NET_WM_NAME, if it's not set WM_CLASS, if none - just set it to MaxAscii (so those icons without proper name hint will be staying unsorted as now but at the end after all sorted ones)