module/tray: init

Introduce new module implementing the status notifier
spec (https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/). The
core dbus logic and spec implementation is from
swaybar (https://github.com/swaywm/sway/tree/master/swaybar/tray), with
rendering stripped out and a switch to tllist. The dbus loop is async and not
re-entrant so the module lock is taken each time we process a message (and when
we process content). To reduce memory usage the icon pixmaps are immutable and
reference counted. So they can be passed between the module and the
particles (through tags) without copying.

Work to be done in future diffs:
1. Tray interactivity/menu support
2. Support KDE search paths for the tray.  Can it be implemented with yml
   scripting?
This commit is contained in:
Jordan Isaacs 2023-11-13 23:27:18 -08:00
parent 6113f9b94e
commit df08456d08
No known key found for this signature in database
GPG key ID: 98983D44651F8116
6 changed files with 1248 additions and 0 deletions

View file

@ -14,6 +14,7 @@ depends=(
'libyaml'
'alsa-lib'
'libpng'
'libsystemd.so'
'libudev.so'
'json-c'
'libmpdclient'

View file

@ -204,6 +204,7 @@ summary(
'River': plugin_river_enabled,
'Script': plugin_script_enabled,
'Sway XKB keyboard': plugin_sway_xkb_enabled,
'Tray': plugin_tray_enabled,
'XKB keyboard (for X11)': plugin_xkb_enabled,
'XWindow (window tracking for X11)': plugin_xwindow_enabled,
},

View file

@ -44,6 +44,8 @@ option('plugin-script', type: 'feature', value: 'auto',
description: 'Script support')
option('plugin-sway-xkb', type: 'feature', value: 'auto',
description: 'keyboard support for Sway')
option('plugin-tray', type: 'feature', value: 'auto',
description: 'Tray support')
option('plugin-xkb', type: 'feature', value: 'auto',
description: 'keyboard support for X11')
option('plugin-xwindow', type: 'feature', value: 'auto',

View file

@ -6,6 +6,9 @@ modules = []
alsa = dependency('alsa', required: get_option('plugin-alsa'))
plugin_alsa_enabled = alsa.found()
systemd = dependency('libsystemd', required: get_option('plugin-tray'))
plugin_tray_enabled = systemd.found()
udev_backlight = dependency('libudev', required: get_option('plugin-backlight'))
plugin_backlight_enabled = udev_backlight.found()
@ -121,6 +124,10 @@ if plugin_sway_xkb_enabled
mod_data += {'sway-xkb': [['i3-common.c', 'i3-common.h'], [dynlist, json_sway_xkb]]}
endif
if plugin_tray_enabled
mod_data += {'tray': [[], [m, dynlist, systemd]]}
endif
if plugin_xkb_enabled
mod_data += {'xkb': [[], [xcb_stuff, xcb_xkb]]}
endif

1231
modules/tray.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -81,6 +81,9 @@ EXTERN_MODULE(river);
#if defined(HAVE_PLUGIN_script)
EXTERN_MODULE(script);
#endif
#if defined(HAVE_PLUGIN_tray)
EXTERN_MODULE(tray);
#endif
#if defined(HAVE_PLUGIN_sway_xkb)
EXTERN_MODULE(sway_xkb);
#endif
@ -215,6 +218,9 @@ static void __attribute__((constructor)) init(void)
#if defined(HAVE_PLUGIN_sway_xkb)
REGISTER_CORE_MODULE(sway-xkb, sway_xkb);
#endif
#if defined(HAVE_PLUGIN_tray)
REGISTER_CORE_MODULE(tray, tray);
#endif
#if defined(HAVE_PLUGIN_xkb)
REGISTER_CORE_MODULE(xkb, xkb);
#endif