-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Tray Icons #1234
Implement Tray Icons #1234
Conversation
This commit implements the StatusNotifierItem protocol, and enables swaybar to show tray icons. It also uses `xembedsniproxy` in order to communicate with xembed applications. The tray is completely optional, and can be disabled on compile time with the `enable-tray` option. Or on runtime with the bar config option `tray_output none`. Overview of changes: In swaybar very little is changed outside the tray subfolder except that all events are now polled in `event_loop.c`, this creates no functional difference. Six bar configuration options were added, these are detailed in sway-bar(5) The tray subfolder is where all protocol implementation takes place and is organised as follows: tray/sni_watcher.c: This file contains the StatusNotifierWatcher. It keeps track of items and hosts and reports when they come or go. tray/tray.c This file contains the StatusNotifierHost. It keeps track of sway's version of the items and represents the tray itself. tray/sni.c This file contains the StatusNotifierItem struct and all communication with individual items. tray/icon.c This file implements the icon theme protocol. It allows for finding icons by name, rather than by pixmap. tray/dbus.c This file allows for asynchronous DBus communication. See #986 #343
One commit ;_; |
swaybar/bar.c
Outdated
} | ||
tray_width -= icon_width; | ||
} | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this into another file?
swaybar/bar.c
Outdated
_exit(EXIT_FAILURE); | ||
} | ||
} | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider moving this as well, just have a tray upkeep function that checks this and refires it if not running
swaybar/bar.c
Outdated
/* Start xembedsniproxy */ | ||
spawn_xembed_sni_proxy(); | ||
} | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one too, just make it a simple
#ifdef ENABLE_TRAY
init_tray();
#endif
Then make init_tray do all this work. Try to limit the tray code in this file to simple calls to another function.
swaybar/render.c
Outdated
tray_width -= tray_padding; | ||
} | ||
|
||
no_tray: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto here. Move it all into a separate function in another file.
Problems I noticed while testing:
|
I also pushed a commit fixing up the cairo blending operator so that partially transparent icons wouldn't overwrite the background. |
Remove tray code from bar.c and render.c
The unique name was not copied out of the wire marshalled DBus message data so `sni_uniq_cmp` would always match against junk data.
Status? |
Still working on getting tray windows working, pretty much everything else is in order. |
Xembed support is premature in sway and should be postponed. This commit only removes swaybar starting xembedsniproxy, if users would like, they can still start xembedsniproxy manually, however there will be no official support.
Should I hold off on rc1 for this? |
I'd say not, unless you really want it there. I can't work on this 100% right now, so it might be good to delay things. Also I'm not even sure if it'd be good to release sni support without xembed included. People who don't know the difference will probably file reports. |
I'm okay with shipping SNI support alone, we already get plenty of stupid support requets and I doubt this will add much. I'll have a look at this in the morning and see if I can clean it up and still feel good about it. |
And probably some other stuff too
Spent some time poking on this. Results: focus is working good enough for now. Also I figured out what was wrong with the firefox address bar dropdown and fixed that. Going to include this in the next release and maybe iterate on it a bit during rc's to fix the edge cases. |
Thanks! |
I'll continue work on xembed, hopefully we can have that in the next release. |
Any progress? |
Yep. |
There are still issues with this commit, mostly in dealing with
xembedsniproxy
. It creates dummy windows for placing XEmbed items which sway renders even though it shouldn't. Alsoxembedsniproxy
is a super buggy program, so there still may be undiscovered problems with it.This commit implements the StatusNotifierItem protocol, and enables
swaybar to show tray icons. It also uses
xembedsniproxy
in order tocommunicate with xembed applications.
The tray is completely optional, and can be disabled on compile time
with the
enable-tray
option. Or on runtime with the bar config optiontray_output none
.Overview of changes:
In swaybar very little is changed outside the tray subfolder except
that all events are now polled in
event_loop.c
, this creates nofunctional difference.
Six bar configuration options were added, these are detailed in
sway-bar(5)
The tray subfolder is where all protocol implementation takes place and
is organised as follows:
tray/sni_watcher.c:
This file contains the StatusNotifierWatcher. It keeps track of
items and hosts and reports when they come or go.
tray/tray.c
This file contains the StatusNotifierHost. It keeps track of
sway's version of the items and represents the tray itself.
tray/sni.c
This file contains the StatusNotifierItem struct and all
communication with individual items.
tray/icon.c
This file implements the icon theme protocol. It allows for
finding icons by name, rather than by pixmap.
tray/dbus.c
This file allows for asynchronous DBus communication.
Note: Package maintainers sholud add xembedsniproxy and libdbus as optional dependencies of sway.
See #986 #343