Skip to content

Commit 20a0768

Browse files
committed
swaybar: set bar dirty when an SNI is added or removed
1 parent 3628df5 commit 20a0768

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

include/swaybar/bar.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ bool bar_setup(struct swaybar *bar, const char *socket_path);
8383
void bar_run(struct swaybar *bar);
8484
void bar_teardown(struct swaybar *bar);
8585

86+
void set_bar_dirty(struct swaybar *bar);
87+
8688
/*
8789
* Determines whether the bar should be visible and changes it to be so.
8890
* If the current visibility of the bar is the different to what it should be,

swaybar/bar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static void destroy_layer_surface(struct swaybar_output *output) {
123123
output->frame_scheduled = false;
124124
}
125125

126-
static void set_bar_dirty(struct swaybar *bar) {
126+
void set_bar_dirty(struct swaybar *bar) {
127127
struct swaybar_output *output;
128128
wl_list_for_each(output, &bar->outputs, link) {
129129
set_output_dirty(output);

swaybar/tray/host_kde.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <stdlib.h>
44
#include <string.h>
55
#include <unistd.h>
6+
#include "swaybar/bar.h"
67
#include "swaybar/tray/host_kde.h"
78
#include "swaybar/tray/item_kde.h"
89
#include "log.h"
@@ -12,6 +13,7 @@ static const char *interface = "org.kde.StatusNotifierHost";
1213
static void add_sni(struct swaybar_host_kde *host, char *id) {
1314
wlr_log(WLR_DEBUG, "Registering Status Notifier Item '%s'", id);
1415
list_add(host->items, create_sni_kde(id, host->tray));
16+
set_bar_dirty(host->tray->bar);
1517
}
1618

1719
static int handle_sni_registered(sd_bus_message *msg, void *data,
@@ -42,6 +44,7 @@ static int handle_sni_unregistered(sd_bus_message *msg, void *data,
4244
if (strcmp(sni->dbus_id, id) == 0) {
4345
wlr_log(WLR_DEBUG, "Unregistering Status Notifier Item '%s'", id);
4446
list_del(host->items, i);
47+
set_bar_dirty(host->tray->bar);
4548
break;
4649
}
4750
}

0 commit comments

Comments
 (0)