diff options
-rw-r--r-- | include/commands.h | 2 | ||||
-rw-r--r-- | include/config.h | 40 | ||||
-rw-r--r-- | sway/config.c | 15 |
3 files changed, 56 insertions, 1 deletions
diff --git a/include/commands.h b/include/commands.h index 9135c670..f291e7cb 100644 --- a/include/commands.h +++ b/include/commands.h @@ -16,6 +16,8 @@ enum cmd_status { // Config Blocks CMD_BLOCK_END, CMD_BLOCK_MODE, + CMD_BLOCK_BAR, + CMD_BLOCK_BAR_COLORS }; /** diff --git a/include/config.h b/include/config.h index b9ef340b..81d4cd20 100644 --- a/include/config.h +++ b/include/config.h @@ -4,6 +4,7 @@ #include <stdint.h> #include <wlc/wlc.h> #include <xkbcommon/xkbcommon.h> +#include "wayland-desktop-shell-server-protocol.h" #include "list.h" #include "layout.h" #include "container.h" @@ -57,6 +58,44 @@ struct workspace_output { char *workspace; }; +struct bar_config { + /** + * One of "dock", "hide", "invisible" + * + * Always visible in dock mode. Visible only when modifier key is held in hide mode. + * Never visible in invisible mode. + */ + char *mode; + /** + * One of "show" or "hide". + * + * In "show" mode, it will always be shown on top of the active workspace. + */ + char *hidden_state; + uint32_t modifier; + enum desktop_shell_panel_position position; + char *status_command; + char *font; + int bar_height; + bool workspace_buttons; + bool strip_workspace_numbers; + bool binding_mode_indicator; + bool verbose; + struct { + char *background; + char *foreground; + char *focused_workspace_border; + char *focused_workspace_bg; + char *focused_workspace_text; + char *active_workspace_border; + char *active_workspace_bg; + char *active_workspace_text; + char *inactive_workspace_border; + char *inactive_workspace_bg; + char *inactive_workspace_text; + } colors; +}; + /** * The configuration struct. The result of loading a config file. */ @@ -68,6 +107,7 @@ struct sway_config { list_t *output_configs; list_t *criteria; struct sway_mode *current_mode; + struct bar_config bar; uint32_t floating_mod; enum swayc_layouts default_orientation; enum swayc_layouts default_layout; diff --git a/sway/config.c b/sway/config.c index aa4675ce..59e6e476 100644 --- a/sway/config.c +++ b/sway/config.c @@ -3,6 +3,7 @@ #include <stdlib.h> #include <unistd.h> #include <wordexp.h> +#include "wayland-desktop-shell-server-protocol.h" #include "readline.h" #include "stringop.h" #include "list.h" @@ -115,6 +116,18 @@ static void config_defaults(struct sway_config *config) { config->edge_gaps = true; config->gaps_inner = 0; config->gaps_outer = 0; + + // Bar + config->bar.mode = "dock"; + config->bar.hidden_state = "hide"; + config->bar.modifier = 0; + config->bar.position = DESKTOP_SHELL_PANEL_POSITION_BOTTOM; + config->bar.status_command = "while :; do date +'%Y-%m-%d %l:%M:%S %p' && sleep 1; done"; + config->bar.font = "monospace 10"; + config->bar.bar_height = -1; + config->bar.workspace_buttons = true; + config->bar.strip_workspace_numbers = false; + config->bar.binding_mode_indicator = true; } static char *get_config_path(void) { @@ -190,7 +203,7 @@ bool load_config(const char *file) { bool read_config(FILE *file, bool is_active) { struct sway_config *old_config = config; - config = malloc(sizeof(struct sway_config)); + config = calloc(1, sizeof(struct sway_config)); config_defaults(config); config->reading = true; |