From ed227f5664196d85194d63d01a5382499867a386 Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Sun, 24 Jan 2016 15:55:58 +0100 Subject: swaybar: move headers to include/bar --- swaybar/bar.c | 10 ++++---- swaybar/bar.h | 55 ---------------------------------------- swaybar/config.c | 2 +- swaybar/config.h | 69 --------------------------------------------------- swaybar/ipc.c | 4 +-- swaybar/ipc.h | 17 ------------- swaybar/main.c | 2 +- swaybar/render.c | 6 ++--- swaybar/render.h | 17 ------------- swaybar/status_line.c | 4 +-- swaybar/status_line.h | 50 ------------------------------------- 11 files changed, 14 insertions(+), 222 deletions(-) delete mode 100644 swaybar/bar.h delete mode 100644 swaybar/config.h delete mode 100644 swaybar/ipc.h delete mode 100644 swaybar/render.h delete mode 100644 swaybar/status_line.h (limited to 'swaybar') diff --git a/swaybar/bar.c b/swaybar/bar.c index fc01863b..d80c9af3 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c @@ -8,11 +8,11 @@ #include "ipc-client.h" #include "list.h" #include "log.h" -#include "ipc.h" -#include "render.h" -#include "config.h" -#include "status_line.h" -#include "bar.h" +#include "bar/ipc.h" +#include "bar/render.h" +#include "bar/config.h" +#include "bar/status_line.h" +#include "bar/bar.h" static void bar_init(struct bar *bar) { bar->config = init_config(); diff --git a/swaybar/bar.h b/swaybar/bar.h deleted file mode 100644 index 89496da6..00000000 --- a/swaybar/bar.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef _SWAYBAR_BAR_H -#define _SWAYBAR_BAR_H - -#include "client/registry.h" -#include "client/window.h" -#include "list.h" - -struct bar { - struct config *config; - struct status_line *status; - struct output *output; - /* list_t *outputs; */ - - int ipc_event_socketfd; - int ipc_socketfd; - int status_read_fd; - pid_t status_command_pid; -}; - -struct output { - struct window *window; - struct registry *registry; - list_t *workspaces; - char *name; -}; - -struct workspace { - int num; - char *name; - bool focused; - bool visible; - bool urgent; -}; - -/** - * Setup bar. - */ -void bar_setup(struct bar *bar, const char *socket_path, const char *bar_id, int desired_output); - -/** - * Bar mainloop. - */ -void bar_run(struct bar *bar); - -/** - * free workspace list. - */ -void free_workspaces(list_t *workspaces); - -/** - * Teardown bar. - */ -void bar_teardown(struct bar *bar); - -#endif /* _SWAYBAR_BAR_H */ diff --git a/swaybar/config.c b/swaybar/config.c index 28b609e6..92251831 100644 --- a/swaybar/config.c +++ b/swaybar/config.c @@ -3,7 +3,7 @@ #include "wayland-desktop-shell-client-protocol.h" #include "log.h" -#include "config.h" +#include "bar/config.h" uint32_t parse_color(const char *color) { if (color[0] != '#') { diff --git a/swaybar/config.h b/swaybar/config.h deleted file mode 100644 index 508b9c42..00000000 --- a/swaybar/config.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef _SWAYBAR_CONFIG_H -#define _SWAYBAR_CONFIG_H - -#include -#include - -/** - * Colors for a box with background, border and text colors. - */ -struct box_colors { - uint32_t border; - uint32_t background; - uint32_t text; -}; - -/** - * Swaybar config. - */ -struct config { - char *status_command; - uint32_t position; - char *font; - char *sep_symbol; - char *mode; - bool strip_workspace_numbers; - bool binding_mode_indicator; - bool workspace_buttons; - - int height; - - struct { - uint32_t background; - uint32_t statusline; - uint32_t separator; - - struct box_colors focused_workspace; - struct box_colors active_workspace; - struct box_colors inactive_workspace; - struct box_colors urgent_workspace; - struct box_colors binding_mode; - } colors; -}; - -/** - * Parse colors defined as hex string to uint32_t. - */ -uint32_t parse_color(const char *color); - -/** - * Parse position top|bottom|left|right. - */ -uint32_t parse_position(const char *position); - -/** - * Parse font. - */ -char *parse_font(const char *font); - -/** - * Initialize default sway config. - */ -struct config *init_config(); - -/** - * Free config struct. - */ -void free_config(struct config *config); - -#endif /* _SWAYBAR_CONFIG_H */ diff --git a/swaybar/ipc.c b/swaybar/ipc.c index 547041ce..4104103d 100644 --- a/swaybar/ipc.c +++ b/swaybar/ipc.c @@ -4,8 +4,8 @@ #include "ipc-client.h" #include "list.h" #include "log.h" -#include "config.h" -#include "ipc.h" +#include "bar/config.h" +#include "bar/ipc.h" static void ipc_parse_config(struct config *config, const char *payload) { json_object *bar_config = json_tokener_parse(payload); diff --git a/swaybar/ipc.h b/swaybar/ipc.h deleted file mode 100644 index c3f661f8..00000000 --- a/swaybar/ipc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _SWAYBAR_IPC_H -#define _SWAYBAR_IPC_H - -#include "bar.h" - -/** - * Initialize ipc connection to sway and get sway state, outputs, bar_config. - */ -void ipc_bar_init(struct bar *bar, int outputi, const char *bar_id); - -/** - * Handle ipc event from sway. - */ -bool handle_ipc_event(struct bar *bar); - -#endif /* _SWAYBAR_IPC_H */ - diff --git a/swaybar/main.c b/swaybar/main.c index fc5acdae..737ee647 100644 --- a/swaybar/main.c +++ b/swaybar/main.c @@ -5,7 +5,7 @@ #include #include "ipc-client.h" #include "log.h" -#include "bar.h" +#include "bar/bar.h" /* global bar state */ struct bar swaybar; diff --git a/swaybar/render.c b/swaybar/render.c index f3ce6010..bac44075 100644 --- a/swaybar/render.c +++ b/swaybar/render.c @@ -4,9 +4,9 @@ #include "client/pango.h" #include "client/window.h" -#include "config.h" -#include "status_line.h" -#include "render.h" +#include "bar/config.h" +#include "bar/status_line.h" +#include "bar/render.h" /* internal spacing */ diff --git a/swaybar/render.h b/swaybar/render.h deleted file mode 100644 index 931a1cdd..00000000 --- a/swaybar/render.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _SWAYBAR_RENDER_H -#define _SWAYBAR_RENDER_H - -#include "config.h" -#include "bar.h" - -/** - * Render swaybar. - */ -void render(struct output *output, struct config *config, struct status_line *line); - -/** - * Set window height and modify internal spacing accordingly. - */ -void set_window_height(struct window *window, int height); - -#endif /* _SWAYBAR_RENDER_H */ diff --git a/swaybar/status_line.c b/swaybar/status_line.c index 6b630c49..ba6de6a1 100644 --- a/swaybar/status_line.c +++ b/swaybar/status_line.c @@ -4,8 +4,8 @@ #include #include "log.h" -#include "config.h" -#include "status_line.h" +#include "bar/config.h" +#include "bar/status_line.h" #define I3JSON_MAXDEPTH 4 #define I3JSON_UNKNOWN 0 diff --git a/swaybar/status_line.h b/swaybar/status_line.h deleted file mode 100644 index 273542dc..00000000 --- a/swaybar/status_line.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef _SWAYBAR_STATUS_LINE_H -#define _SWAYBAR_STATUS_LINE_H - -#include -#include - -#include "list.h" -#include "bar.h" - -typedef enum {UNDEF, TEXT, I3BAR} command_protocol; - -struct status_line { - list_t *block_line; - const char *text_line; - command_protocol protocol; -}; - -struct status_block { - char *full_text, *short_text, *align; - bool urgent; - uint32_t color; - int min_width; - char *name, *instance; - bool separator; - int separator_block_width; - // Airblader features - uint32_t background; - uint32_t border; - int border_top; - int border_bottom; - int border_left; - int border_right; -}; - -/** - * Initialize status line struct. - */ -struct status_line *init_status_line(); - -/** - * handle status line activity. - */ -bool handle_status_line(struct bar *bar); - -/** - * Free status line struct. - */ -void free_status_line(struct status_line *line); - -#endif /* _SWAYBAR_STATUS_LINE_H */ -- cgit v1.2.3