aboutsummaryrefslogtreecommitdiff
path: root/include/swaybar
diff options
context:
space:
mode:
Diffstat (limited to 'include/swaybar')
-rw-r--r--include/swaybar/bar.h37
-rw-r--r--include/swaybar/config.h5
-rw-r--r--include/swaybar/i3bar.h2
-rw-r--r--include/swaybar/ipc.h4
-rw-r--r--include/swaybar/status_line.h3
5 files changed, 39 insertions, 12 deletions
diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h
index de234111..9ff3fe7b 100644
--- a/include/swaybar/bar.h
+++ b/include/swaybar/bar.h
@@ -37,7 +37,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 +46,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;
@@ -60,11 +69,11 @@ struct swaybar {
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 +81,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 +97,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 +105,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
diff --git a/include/swaybar/config.h b/include/swaybar/config.h
index d0336c27..5d40790a 100644
--- a/include/swaybar/config.h
+++ b/include/swaybar/config.h
@@ -13,7 +13,7 @@ struct box_colors {
};
struct config_output {
- struct wl_list link;
+ struct wl_list link; // swaybar_config::outputs
char *name;
size_t index;
};
@@ -31,7 +31,8 @@ struct swaybar_config {
char *font;
char *sep_symbol;
char *mode;
- bool mode_pango_markup;
+ char *hidden_state;
+ char *modifier;
bool strip_workspace_numbers;
bool binding_mode_indicator;
bool wrap_scroll;
diff --git a/include/swaybar/i3bar.h b/include/swaybar/i3bar.h
index 12d9b317..d4a48e07 100644
--- a/include/swaybar/i3bar.h
+++ b/include/swaybar/i3bar.h
@@ -5,7 +5,7 @@
#include "status_line.h"
struct i3bar_block {
- struct wl_list link;
+ struct wl_list link; // status_link::blocks
int ref_count;
char *full_text, *short_text, *align;
bool urgent;
diff --git a/include/swaybar/ipc.h b/include/swaybar/ipc.h
index 8731dac2..d8cd0c76 100644
--- a/include/swaybar/ipc.h
+++ b/include/swaybar/ipc.h
@@ -3,9 +3,9 @@
#include <stdbool.h>
#include "swaybar/bar.h"
-bool ipc_initialize(struct swaybar *bar, const char *bar_id);
+bool ipc_initialize(struct swaybar *bar);
bool handle_ipc_readable(struct swaybar *bar);
-void ipc_get_workspaces(struct swaybar *bar);
+bool ipc_get_workspaces(struct swaybar *bar);
void ipc_send_workspace_command(struct swaybar *bar, const char *ws);
void ipc_execute_binding(struct swaybar *bar, struct swaybar_binding *bind);
diff --git a/include/swaybar/status_line.h b/include/swaybar/status_line.h
index ca88b0c5..5e7e8771 100644
--- a/include/swaybar/status_line.h
+++ b/include/swaybar/status_line.h
@@ -22,6 +22,9 @@ struct status_line {
const char *text;
struct wl_list blocks; // i3bar_block::link
+ int stop_signal;
+ int cont_signal;
+
bool click_events;
bool clicked;
char *buffer;