From 843ad38b3c427adb0bf319e9613d9813c8d9246c Mon Sep 17 00:00:00 2001 From: Calvin Lee Date: Wed, 7 Jun 2017 16:45:28 -0700 Subject: Implement Tray Icons 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 --- include/swaybar/bar.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/swaybar/bar.h') diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h index 697a48c2..010e1f84 100644 --- a/include/swaybar/bar.h +++ b/include/swaybar/bar.h @@ -21,6 +21,9 @@ struct output { struct window *window; struct registry *registry; list_t *workspaces; +#ifdef ENABLE_TRAY + list_t *items; +#endif char *name; int idx; bool focused; @@ -37,6 +40,9 @@ struct workspace { /** Global bar state */ extern struct bar swaybar; +/** True if sway needs to render */ +extern bool dirty; + /** * Setup bar. */ -- cgit v1.2.3 From 1451ee8fd13dd35227d11e393c80871c70ad90f0 Mon Sep 17 00:00:00 2001 From: Calvin Lee Date: Wed, 7 Jun 2017 21:32:48 -0700 Subject: Reorganize Tray Code Remove tray code from bar.c and render.c --- include/swaybar/bar.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/swaybar/bar.h') diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h index 010e1f84..9f5bf400 100644 --- a/include/swaybar/bar.h +++ b/include/swaybar/bar.h @@ -15,6 +15,9 @@ struct bar { int ipc_socketfd; int status_read_fd; pid_t status_command_pid; +#ifdef ENABLE_TRAY + pid_t xembed_pid; +#endif }; struct output { -- cgit v1.2.3 From 33fdae2001f489c40667797ce3bc50eedb352ee0 Mon Sep 17 00:00:00 2001 From: Calvin Lee Date: Tue, 13 Jun 2017 12:42:11 -0700 Subject: Remove Xembed Support 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. --- include/swaybar/bar.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include/swaybar/bar.h') diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h index 9f5bf400..010e1f84 100644 --- a/include/swaybar/bar.h +++ b/include/swaybar/bar.h @@ -15,9 +15,6 @@ struct bar { int ipc_socketfd; int status_read_fd; pid_t status_command_pid; -#ifdef ENABLE_TRAY - pid_t xembed_pid; -#endif }; struct output { -- cgit v1.2.3