This commit is contained in:
lavoiecsh 2026-06-13 22:10:29 +08:00 committed by GitHub
commit 182189be18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 60 additions and 2 deletions

View file

@ -78,6 +78,7 @@ struct swaybar_config *init_config(void) {
#if HAVE_TRAY
config->tray_padding = 2;
config->tray_last = true;
wl_list_init(&config->tray_bindings);
#endif

View file

@ -283,7 +283,7 @@ static bool ipc_parse_config(
config->wrap_scroll = json_object_get_boolean(wrap_scroll);
}
#if HAVE_TRAY
json_object *tray_outputs, *tray_padding, *tray_bindings, *icon_theme;
json_object *tray_outputs, *tray_padding, *tray_last, *tray_bindings, *icon_theme;
if (config->tray_outputs && config->tray_outputs->length) {
list_free_items_and_destroy(config->tray_outputs);
@ -308,6 +308,10 @@ static bool ipc_parse_config(
config->tray_padding = json_object_get_int(tray_padding);
}
if ((json_object_object_get_ex(bar_config, "tray_last", &tray_last))) {
config->tray_last = json_object_get_boolean(tray_last);
}
struct tray_binding *tray_bind = NULL, *tmp_tray_bind = NULL;
wl_list_for_each_safe(tray_bind, tmp_tray_bind, &config->tray_bindings,
link) {

View file

@ -675,8 +675,9 @@ static uint32_t render_to_cairo(struct render_context *ctx) {
* utilize the available space.
*/
double x = output->width;
#if HAVE_TRAY
if (bar->tray) {
if (bar->tray && config->tray_last) {
uint32_t h = render_tray(cairo, output, &x);
max_height = h > max_height ? h : max_height;
}
@ -685,6 +686,13 @@ static uint32_t render_to_cairo(struct render_context *ctx) {
uint32_t h = render_status_line(ctx, &x);
max_height = h > max_height ? h : max_height;
}
#if HAVE_TRAY
if (bar->tray && !config->tray_last) {
uint32_t h = render_tray(cairo, output, &x);
max_height = h > max_height ? h : max_height;
}
#endif
x = 0;
if (config->workspace_buttons) {
struct swaybar_workspace *ws;