aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sway/commands/bar.c14
-rw-r--r--sway/commands/bar/status_command.c16
-rw-r--r--sway/sway-bar.5.scd3
3 files changed, 23 insertions, 10 deletions
diff --git a/sway/commands/bar.c b/sway/commands/bar.c
index f760888e..03f4c557 100644
--- a/sway/commands/bar.c
+++ b/sway/commands/bar.c
@@ -46,14 +46,14 @@ struct cmd_results *cmd_bar(int argc, char **argv) {
46 return error; 46 return error;
47 } 47 }
48 48
49 if (!config->reading) { 49 if (find_handler(argv[0], bar_config_handlers,
50 if (!find_handler(argv[0], bar_config_handlers, 50 sizeof(bar_config_handlers))) {
51 sizeof(bar_config_handlers))) { 51 if (config->reading) {
52 return cmd_results_new(CMD_FAILURE, "bar", 52 return config_subcommand(argv, argc, bar_config_handlers,
53 "Can only be used in config file."); 53 sizeof(bar_config_handlers));
54 } 54 }
55 return config_subcommand(argv, argc, bar_config_handlers, 55 return cmd_results_new(CMD_FAILURE, "bar",
56 sizeof(bar_config_handlers)); 56 "Can only be used in config file.");
57 } 57 }
58 58
59 if (argc > 1) { 59 if (argc > 1) {
diff --git a/sway/commands/bar/status_command.c b/sway/commands/bar/status_command.c
index 6f6f81a3..5ea22525 100644
--- a/sway/commands/bar/status_command.c
+++ b/sway/commands/bar/status_command.c
@@ -13,8 +13,18 @@ struct cmd_results *bar_cmd_status_command(int argc, char **argv) {
13 "status_command", "No bar defined."); 13 "status_command", "No bar defined.");
14 } 14 }
15 free(config->current_bar->status_command); 15 free(config->current_bar->status_command);
16 config->current_bar->status_command = join_args(argv, argc); 16 config->current_bar->status_command = NULL;
17 wlr_log(WLR_DEBUG, "Feeding bar with status command: %s", 17
18 config->current_bar->status_command); 18 char *new_command = join_args(argv, argc);
19 if (strcmp(new_command, "-") != 0) {
20 config->current_bar->status_command = new_command;
21 wlr_log(WLR_DEBUG, "Feeding bar with status command: %s",
22 config->current_bar->status_command);
23 }
24
25 if (config->active && !config->validating) {
26 load_swaybars();
27 }
28
19 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 29 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
20} 30}
diff --git a/sway/sway-bar.5.scd b/sway/sway-bar.5.scd
index 00b9386e..8c7be8e7 100644
--- a/sway/sway-bar.5.scd
+++ b/sway/sway-bar.5.scd
@@ -17,6 +17,9 @@ Sway allows configuring swaybar in the sway configuration file.
17 17
18 https://i3wm.org/docs/i3bar-protocol.html 18 https://i3wm.org/docs/i3bar-protocol.html
19 19
20 If running this command via IPC, you can disable a running status command by
21 setting the command to a single dash: _swaybar bar bar-0 status\_command -_
22
20*pango\_markup* enabled|disabled 23*pango\_markup* enabled|disabled
21 Enables or disables pango markup for status lines. This has no effect on 24 Enables or disables pango markup for status lines. This has no effect on
22 status lines using the i3bar JSON protocol. 25 status lines using the i3bar JSON protocol.