aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2015-12-14 16:24:01 +0100
committerLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2015-12-14 17:17:06 +0100
commitc6b13163c93f7464ae21fa238fadc238b8ef2936 (patch)
tree4722e7006ea46d5b1ba30bd5113a7705f71338b8 /sway
parentMove sway/util.c to common/util.c (diff)
downloadsway-c6b13163c93f7464ae21fa238fadc238b8ef2936.tar.gz
sway-c6b13163c93f7464ae21fa238fadc238b8ef2936.tar.zst
sway-c6b13163c93f7464ae21fa238fadc238b8ef2936.zip
Add initial support for custom bar-id
Diffstat (limited to 'sway')
-rw-r--r--sway/commands.c14
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 @@
15#include "layout.h" 15#include "layout.h"
16#include "focus.h" 16#include "focus.h"
17#include "log.h" 17#include "log.h"
18#include "util.h"
18#include "workspace.h" 19#include "workspace.h"
19#include "commands.h" 20#include "commands.h"
20#include "container.h" 21#include "container.h"
@@ -1124,9 +1125,20 @@ static struct cmd_results *cmd_bar(int argc, char **argv) {
1124 bar->tray_padding = config->bar.tray_padding; 1125 bar->tray_padding = config->bar.tray_padding;
1125 list_add(config->bars, bar); 1126 list_add(config->bars, bar);
1126 1127
1128 // set bar id
1129 int i;
1130 for (i = 0; i < config->bars->length; ++i) {
1131 if (bar == config->bars->items[i]) {
1132 const int len = 5 + numlen(i); // "bar-" + i + \0
1133 bar->id = malloc(len * sizeof(char));
1134 snprintf(bar->id, len, "bar-%d", i);
1135 break;
1136 }
1137 }
1138
1127 // Set current bar 1139 // Set current bar
1128 config->current_bar = bar; 1140 config->current_bar = bar;
1129 sway_log(L_DEBUG, "Configuring bar"); 1141 sway_log(L_DEBUG, "Configuring bar %s", bar->id);
1130 return cmd_results_new(CMD_BLOCK_BAR, NULL, NULL); 1142 return cmd_results_new(CMD_BLOCK_BAR, NULL, NULL);
1131} 1143}
1132 1144