aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/bar/id.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2017-11-18 11:22:02 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2017-11-18 11:22:02 -0500
commit733993a651c71f7e2198d505960d6bbd31e0e107 (patch)
treee51732c5872b624e73355f9e5b3f762101f3cd0d /sway/commands/bar/id.c
parentInitial (awful) pass on xdg shell support (diff)
downloadsway-733993a651c71f7e2198d505960d6bbd31e0e107.tar.gz
sway-733993a651c71f7e2198d505960d6bbd31e0e107.tar.zst
sway-733993a651c71f7e2198d505960d6bbd31e0e107.zip
Move everything to sway/old/
Diffstat (limited to 'sway/commands/bar/id.c')
-rw-r--r--sway/commands/bar/id.c33
1 files changed, 0 insertions, 33 deletions
diff --git a/sway/commands/bar/id.c b/sway/commands/bar/id.c
deleted file mode 100644
index 1221ebf6..00000000
--- a/sway/commands/bar/id.c
+++ /dev/null
@@ -1,33 +0,0 @@
1#define _XOPEN_SOURCE 500
2#include <string.h>
3#include "sway/commands.h"
4#include "log.h"
5
6struct cmd_results *bar_cmd_id(int argc, char **argv) {
7 struct cmd_results *error = NULL;
8 if ((error = checkarg(argc, "id", EXPECTED_EQUAL_TO, 1))) {
9 return error;
10 }
11
12 const char *name = argv[0];
13 const char *oldname = config->current_bar->id;
14
15 // check if id is used by a previously defined bar
16 int i;
17 for (i = 0; i < config->bars->length; ++i) {
18 struct bar_config *find = config->bars->items[i];
19 if (strcmp(name, find->id) == 0 && config->current_bar != find) {
20 return cmd_results_new(CMD_FAILURE, "id",
21 "Id '%s' already defined for another bar. Id unchanged (%s).",
22 name, oldname);
23 }
24 }
25
26 sway_log(L_DEBUG, "Renaming bar: '%s' to '%s'", oldname, name);
27
28 // free old bar id
29 free(config->current_bar->id);
30
31 config->current_bar->id = strdup(name);
32 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
33}