diff options
author | Mikkel Oscar Lyderik <mikkeloscar@gmail.com> | 2015-12-14 16:24:01 +0100 |
---|---|---|
committer | Mikkel Oscar Lyderik <mikkeloscar@gmail.com> | 2015-12-14 17:17:06 +0100 |
commit | c6b13163c93f7464ae21fa238fadc238b8ef2936 (patch) | |
tree | 4722e7006ea46d5b1ba30bd5113a7705f71338b8 /sway | |
parent | cf56c41c10b85882d7563c95abe185f450b4ec2b (diff) | |
download | sway-c6b13163c93f7464ae21fa238fadc238b8ef2936.tar.xz |
Add initial support for custom bar-id
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sway/commands.c b/sway/commands.c index b0235dba..ea138dfc 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -15,6 +15,7 @@ #include "layout.h" #include "focus.h" #include "log.h" +#include "util.h" #include "workspace.h" #include "commands.h" #include "container.h" @@ -1124,9 +1125,20 @@ static struct cmd_results *cmd_bar(int argc, char **argv) { bar->tray_padding = config->bar.tray_padding; list_add(config->bars, bar); + // set bar id + int i; + for (i = 0; i < config->bars->length; ++i) { + if (bar == config->bars->items[i]) { + const int len = 5 + numlen(i); // "bar-" + i + \0 + bar->id = malloc(len * sizeof(char)); + snprintf(bar->id, len, "bar-%d", i); + break; + } + } + // Set current bar config->current_bar = bar; - sway_log(L_DEBUG, "Configuring bar"); + sway_log(L_DEBUG, "Configuring bar %s", bar->id); return cmd_results_new(CMD_BLOCK_BAR, NULL, NULL); } |