summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/config.h1
-rw-r--r--sway/commands.c19
-rw-r--r--sway/config.c1
3 files changed, 21 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h
index b89ad553..e6fc9f28 100644
--- a/include/config.h
+++ b/include/config.h
@@ -92,6 +92,7 @@ struct bar_config {
92 enum desktop_shell_panel_position position; 92 enum desktop_shell_panel_position position;
93 list_t *bindings; 93 list_t *bindings;
94 char *status_command; 94 char *status_command;
95 char *swaybar_command;
95 char *font; 96 char *font;
96 int height; // -1 not defined 97 int height; // -1 not defined
97 int tray_padding; 98 int tray_padding;
diff --git a/sway/commands.c b/sway/commands.c
index 13bc7dc2..4af9186a 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -79,6 +79,7 @@ static sway_cmd bar_cmd_position;
79static sway_cmd bar_cmd_separator_symbol; 79static sway_cmd bar_cmd_separator_symbol;
80static sway_cmd bar_cmd_status_command; 80static sway_cmd bar_cmd_status_command;
81static sway_cmd bar_cmd_strip_workspace_numbers; 81static sway_cmd bar_cmd_strip_workspace_numbers;
82static sway_cmd bar_cmd_swaybar_command;
82static sway_cmd bar_cmd_tray_output; 83static sway_cmd bar_cmd_tray_output;
83static sway_cmd bar_cmd_tray_padding; 84static sway_cmd bar_cmd_tray_padding;
84static sway_cmd bar_cmd_workspace_buttons; 85static sway_cmd bar_cmd_workspace_buttons;
@@ -1918,6 +1919,23 @@ static struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv
1918 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 1919 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
1919} 1920}
1920 1921
1922static struct cmd_results *bar_cmd_swaybar_command(int argc, char **argv) {
1923 struct cmd_results *error = NULL;
1924 if ((error = checkarg(argc, "swaybar_command", EXPECTED_AT_LEAST, 1))) {
1925 return error;
1926 }
1927
1928 if (!config->current_bar) {
1929 return cmd_results_new(CMD_FAILURE, "swaybar_command", "No bar defined.");
1930 }
1931
1932 free(config->current_bar->swaybar_command);
1933 config->current_bar->swaybar_command = join_args(argv, argc);
1934 sway_log(L_DEBUG, "Using custom swaybar command: %s", config->current_bar->swaybar_command);
1935
1936 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
1937}
1938
1921static struct cmd_results *bar_cmd_tray_output(int argc, char **argv) { 1939static struct cmd_results *bar_cmd_tray_output(int argc, char **argv) {
1922 sway_log(L_ERROR, "warning: tray_output is not supported on wayland"); 1940 sway_log(L_ERROR, "warning: tray_output is not supported on wayland");
1923 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 1941 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
@@ -1986,6 +2004,7 @@ static struct cmd_handler bar_handlers[] = {
1986 { "separator_symbol", bar_cmd_separator_symbol }, 2004 { "separator_symbol", bar_cmd_separator_symbol },
1987 { "status_command", bar_cmd_status_command }, 2005 { "status_command", bar_cmd_status_command },
1988 { "strip_workspace_numbers", bar_cmd_strip_workspace_numbers }, 2006 { "strip_workspace_numbers", bar_cmd_strip_workspace_numbers },
2007 { "swaybar_command", bar_cmd_swaybar_command },
1989 { "tray_output", bar_cmd_tray_output }, 2008 { "tray_output", bar_cmd_tray_output },
1990 { "tray_padding", bar_cmd_tray_padding }, 2009 { "tray_padding", bar_cmd_tray_padding },
1991 { "workspace_buttons", bar_cmd_workspace_buttons }, 2010 { "workspace_buttons", bar_cmd_workspace_buttons },
diff --git a/sway/config.c b/sway/config.c
index 928d35a8..b0871366 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -673,6 +673,7 @@ struct bar_config *default_bar_config(void) {
673 bar->position = DESKTOP_SHELL_PANEL_POSITION_BOTTOM; 673 bar->position = DESKTOP_SHELL_PANEL_POSITION_BOTTOM;
674 bar->bindings = create_list(); 674 bar->bindings = create_list();
675 bar->status_command = strdup("while :; do date +'%Y-%m-%d %l:%M:%S %p' && sleep 1; done"); 675 bar->status_command = strdup("while :; do date +'%Y-%m-%d %l:%M:%S %p' && sleep 1; done");
676 bar->swaybar_command = NULL;
676 bar->font = strdup("monospace 10"); 677 bar->font = strdup("monospace 10");
677 bar->height = -1; 678 bar->height = -1;
678 bar->workspace_buttons = true; 679 bar->workspace_buttons = true;