aboutsummaryrefslogtreecommitdiff
path: root/sway/old/commands/bar/output.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-01-21 12:21:57 -0500
committerDrew DeVault <sir@cmpwn.com>2018-01-21 12:21:57 -0500
commita6bc46eea9d7dec6a2b93f85bac2e3737e0c6725 (patch)
treeebb95fcc4a0709f253f87a0e900adc0fbb51fa32 /sway/old/commands/bar/output.c
parentc933781facbb664fedcd52ab19f35c392cd9e7b4 (diff)
downloadsway-a6bc46eea9d7dec6a2b93f85bac2e3737e0c6725.tar.xz
Remove sway/old/
Diffstat (limited to 'sway/old/commands/bar/output.c')
-rw-r--r--sway/old/commands/bar/output.c50
1 files changed, 0 insertions, 50 deletions
diff --git a/sway/old/commands/bar/output.c b/sway/old/commands/bar/output.c
deleted file mode 100644
index a5710bc0..00000000
--- a/sway/old/commands/bar/output.c
+++ /dev/null
@@ -1,50 +0,0 @@
-#define _XOPEN_SOURCE 500
-#include <string.h>
-#include "sway/commands.h"
-#include "list.h"
-#include "log.h"
-
-struct cmd_results *bar_cmd_output(int argc, char **argv) {
- struct cmd_results *error = NULL;
- if ((error = checkarg(argc, "output", EXPECTED_EQUAL_TO, 1))) {
- return error;
- }
-
- if (!config->current_bar) {
- return cmd_results_new(CMD_FAILURE, "output", "No bar defined.");
- }
-
- const char *output = argv[0];
- list_t *outputs = config->current_bar->outputs;
- if (!outputs) {
- outputs = create_list();
- config->current_bar->outputs = outputs;
- }
-
- int i;
- int add_output = 1;
- if (strcmp("*", output) == 0) {
- // remove all previous defined outputs and replace with '*'
- for (i = 0; i < outputs->length; ++i) {
- free(outputs->items[i]);
- list_del(outputs, i);
- }
- } else {
- // only add output if not already defined with either the same
- // name or as '*'
- for (i = 0; i < outputs->length; ++i) {
- const char *find = outputs->items[i];
- if (strcmp("*", find) == 0 || strcmp(output, find) == 0) {
- add_output = 0;
- break;
- }
- }
- }
-
- if (add_output) {
- list_add(outputs, strdup(output));
- sway_log(L_DEBUG, "Adding bar: '%s' to output '%s'", config->current_bar->id, output);
- }
-
- return cmd_results_new(CMD_SUCCESS, NULL, NULL);
-}