diff options
Diffstat (limited to 'include/swaybar/bar.h')
-rw-r--r-- | include/swaybar/bar.h | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h index de234111..58e2dee6 100644 --- a/include/swaybar/bar.h +++ b/include/swaybar/bar.h @@ -8,6 +8,7 @@ struct swaybar_config; struct swaybar_output; struct swaybar_workspace; +struct loop; struct swaybar_pointer { struct wl_pointer *pointer; @@ -37,7 +38,7 @@ enum hotspot_event_handling { }; struct swaybar_hotspot { - struct wl_list link; + struct wl_list link; // swaybar_output::hotspots int x, y, width, height; enum hotspot_event_handling (*callback)(struct swaybar_output *output, int x, int y, enum x11_button button, void *data); @@ -46,6 +47,15 @@ struct swaybar_hotspot { }; struct swaybar { + char *id; + char *mode; + bool mode_pango_markup; + + // only relevant when bar is in "hide" mode + bool visible_by_modifier; + bool visible_by_urgency; + bool visible; + struct wl_display *display; struct wl_compositor *compositor; struct zwlr_layer_shell_v1 *layer_shell; @@ -57,14 +67,16 @@ struct swaybar { struct swaybar_pointer pointer; struct status_line *status; + struct loop *eventloop; + int ipc_event_socketfd; int ipc_socketfd; - struct wl_list outputs; + struct wl_list outputs; // swaybar_output::link }; struct swaybar_output { - struct wl_list link; + struct wl_list link; // swaybar::outputs struct swaybar *bar; struct wl_output *output; struct zxdg_output_v1 *xdg_output; @@ -72,8 +84,8 @@ struct swaybar_output { struct zwlr_layer_surface_v1 *layer_surface; uint32_t wl_name; - struct wl_list workspaces; - struct wl_list hotspots; + struct wl_list workspaces; // swaybar_workspace::link + struct wl_list hotspots; // swaybar_hotspot::link char *name; bool focused; @@ -88,7 +100,7 @@ struct swaybar_output { }; struct swaybar_workspace { - struct wl_list link; + struct wl_list link; // swaybar_output::workspaces int num; char *name; bool focused; @@ -96,10 +108,24 @@ struct swaybar_workspace { bool urgent; }; -bool bar_setup(struct swaybar *bar, const char *socket_path, const char *bar_id); +bool bar_setup(struct swaybar *bar, const char *socket_path); void bar_run(struct swaybar *bar); void bar_teardown(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, + * then it adds or destroys the layer surface as required, + * as well as sending the cont or stop signal to the status command. + * If the current visibility of the bar is already what it should be, + * then this function is a no-op, unless moving_layer is true, which occurs + * when the bar changes from "hide" to "dock" mode or vice versa, and the bar + * needs to be destroyed and re-added in order to change its layer. + * + * Returns true if the bar is now visible, otherwise false. + */ +bool determine_bar_visibility(struct swaybar *bar, bool moving_layer); +void free_hotspots(struct wl_list *list); void free_workspaces(struct wl_list *list); #endif |