awesome icon indicating copy to clipboard operation
awesome copied to clipboard

Feature Request: custom sorting for systray

Open figsoda opened this issue 3 years ago • 7 comments

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~.

figsoda avatar Jul 03 '21 02:07 figsoda

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?

psychon avatar Jul 04 '21 15:07 psychon

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.

figsoda avatar Jul 04 '21 21:07 figsoda

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

actionless avatar Jul 06 '21 05:07 actionless

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.

Elv13 avatar Jul 06 '21 09:07 Elv13

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

pushcx avatar Jan 09 '22 03:01 pushcx

@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.

psychon avatar Jan 09 '22 09:01 psychon

@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)

actionless avatar Feb 03 '22 02:02 actionless