summaryrefslogtreecommitdiffstats
path: root/swaybar/bar.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-03-29 00:21:05 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2018-03-29 22:11:08 -0400
commit3399ad9840f0d3d42b377f4404115d887f65e18a (patch)
tree33c5d7fd9af3662646f426f4e2dee4722bf0e0b3 /swaybar/bar.c
parentOnly utilize the configured outputs (diff)
downloadsway-3399ad9840f0d3d42b377f4404115d887f65e18a.tar.gz
sway-3399ad9840f0d3d42b377f4404115d887f65e18a.tar.zst
sway-3399ad9840f0d3d42b377f4404115d887f65e18a.zip
Round up workspaces on each output
Diffstat (limited to 'swaybar/bar.c')
-rw-r--r--swaybar/bar.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c
index a6e3b780..68dea408 100644
--- a/swaybar/bar.c
+++ b/swaybar/bar.c
@@ -72,6 +72,7 @@ static void handle_global(void *data, struct wl_registry *registry,
72 output->output = wl_registry_bind(registry, name, 72 output->output = wl_registry_bind(registry, name,
73 &wl_output_interface, 1); 73 &wl_output_interface, 1);
74 output->index = index++; 74 output->index = index++;
75 wl_list_init(&output->workspaces);
75 wl_list_insert(&bar->outputs, &output->link); 76 wl_list_insert(&bar->outputs, &output->link);
76 } else if (strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) { 77 } else if (strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) {
77 bar->layer_shell = wl_registry_bind( 78 bar->layer_shell = wl_registry_bind(
@@ -96,7 +97,7 @@ void bar_setup(struct swaybar *bar,
96 97
97 bar->ipc_socketfd = ipc_open_socket(socket_path); 98 bar->ipc_socketfd = ipc_open_socket(socket_path);
98 bar->ipc_event_socketfd = ipc_open_socket(socket_path); 99 bar->ipc_event_socketfd = ipc_open_socket(socket_path);
99 ipc_get_config(bar, bar_id); 100 ipc_initialize(bar, bar_id);
100 101
101 assert(bar->display = wl_display_connect(NULL)); 102 assert(bar->display = wl_display_connect(NULL));
102 103
@@ -113,6 +114,7 @@ void bar_setup(struct swaybar *bar,
113 if (coutput->index != output->index) { 114 if (coutput->index != output->index) {
114 continue; 115 continue;
115 } 116 }
117 output->name = strdup(coutput->name);
116 assert(output->surface = wl_compositor_create_surface( 118 assert(output->surface = wl_compositor_create_surface(
117 bar->compositor)); 119 bar->compositor));
118 output->layer_surface = zwlr_layer_shell_v1_get_layer_surface( 120 output->layer_surface = zwlr_layer_shell_v1_get_layer_surface(
@@ -123,10 +125,13 @@ void bar_setup(struct swaybar *bar,
123 &layer_surface_listener, output); 125 &layer_surface_listener, output);
124 zwlr_layer_surface_v1_set_anchor(output->layer_surface, 126 zwlr_layer_surface_v1_set_anchor(output->layer_surface,
125 bar->config->position); 127 bar->config->position);
126 render_frame(bar, output);
127 break; 128 break;
128 } 129 }
129 } 130 }
131 ipc_get_workspaces(bar);
132 wl_list_for_each(output, &bar->outputs, link) {
133 render_frame(bar, output);
134 }
130} 135}
131 136
132static void display_in(int fd, short mask, void *_bar) { 137static void display_in(int fd, short mask, void *_bar) {