Skip to content

Commit

Permalink
swaybar: set bar dirty when an SNI is added or removed
Browse files Browse the repository at this point in the history
  • Loading branch information
ianyfan committed Dec 7, 2018
1 parent 3628df5 commit 20a0768
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/swaybar/bar.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ bool bar_setup(struct swaybar *bar, const char *socket_path);
void bar_run(struct swaybar *bar);
void bar_teardown(struct swaybar *bar);

void set_bar_dirty(struct swaybar *bar);

/*
* Determines whether the bar should be visible and changes it to be so.
* If the current visibility of the bar is the different to what it should be,
Expand Down
2 changes: 1 addition & 1 deletion swaybar/bar.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static void destroy_layer_surface(struct swaybar_output *output) {
output->frame_scheduled = false;
}

static void set_bar_dirty(struct swaybar *bar) {
void set_bar_dirty(struct swaybar *bar) {
struct swaybar_output *output;
wl_list_for_each(output, &bar->outputs, link) {
set_output_dirty(output);
Expand Down
3 changes: 3 additions & 0 deletions swaybar/tray/host_kde.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "swaybar/bar.h"
#include "swaybar/tray/host_kde.h"
#include "swaybar/tray/item_kde.h"
#include "log.h"
Expand All @@ -12,6 +13,7 @@ static const char *interface = "org.kde.StatusNotifierHost";
static void add_sni(struct swaybar_host_kde *host, char *id) {
wlr_log(WLR_DEBUG, "Registering Status Notifier Item '%s'", id);
list_add(host->items, create_sni_kde(id, host->tray));
set_bar_dirty(host->tray->bar);
}

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

0 comments on commit 20a0768

Please sign in to comment.