summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2015-12-14 14:56:28 +0100
committerLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2015-12-14 15:14:50 +0100
commitcc08daded412966ba9068ad9ac63c5adea9ef5d4 (patch)
tree8e5c5221ffdc1bb2142777e6315d90d93ddb25e6
parentAdd tray_output not supported warning (diff)
downloadsway-cc08daded412966ba9068ad9ac63c5adea9ef5d4.tar.gz
sway-cc08daded412966ba9068ad9ac63c5adea9ef5d4.tar.zst
sway-cc08daded412966ba9068ad9ac63c5adea9ef5d4.zip
Implement bar option: strip_workspace_numbers <yes|no>
-rw-r--r--sway/commands.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/sway/commands.c b/sway/commands.c
index aeb14642..f5593b05 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -64,6 +64,7 @@ static sway_cmd cmd_sticky;
64static sway_cmd cmd_workspace; 64static sway_cmd cmd_workspace;
65static sway_cmd cmd_ws_auto_back_and_forth; 65static sway_cmd cmd_ws_auto_back_and_forth;
66 66
67static sway_cmd bar_cmd_strip_workspace_numbers;
67static sway_cmd bar_cmd_tray_output; 68static sway_cmd bar_cmd_tray_output;
68static sway_cmd bar_cmd_tray_padding; 69static sway_cmd bar_cmd_tray_padding;
69static sway_cmd bar_cmd_workspace_buttons; 70static sway_cmd bar_cmd_workspace_buttons;
@@ -1522,6 +1523,29 @@ static struct cmd_handler handlers[] = {
1522 { "workspace_auto_back_and_forth", cmd_ws_auto_back_and_forth }, 1523 { "workspace_auto_back_and_forth", cmd_ws_auto_back_and_forth },
1523}; 1524};
1524 1525
1526static struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) {
1527 struct cmd_results *error = NULL;
1528 if ((error = checkarg(argc, "strip_workspace_numbers", EXPECTED_EQUAL_TO, 1))) {
1529 return error;
1530 }
1531
1532 if (!config->current_bar) {
1533 return cmd_results_new(CMD_FAILURE, "strip_workspace_numbers", "No bar defined.");
1534 }
1535
1536 if (strcasecmp("yes", argv[0]) == 0) {
1537 config->current_bar->strip_workspace_numbers = true;
1538 sway_log(L_DEBUG, "Stripping workspace numbers on bar");
1539 } else if (strcasecmp("no", argv[0]) == 0) {
1540 config->current_bar->strip_workspace_numbers = false;
1541 sway_log(L_DEBUG, "Enabling workspace numbers on bar");
1542 } else {
1543 error = cmd_results_new(CMD_INVALID, "strip_workspace_numbers", "Invalid value %s", argv[0]);
1544 return error;
1545 }
1546 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
1547}
1548
1525static struct cmd_results *bar_cmd_tray_output(int argc, char **argv) { 1549static struct cmd_results *bar_cmd_tray_output(int argc, char **argv) {
1526 sway_log(L_ERROR, "warning: tray_output is not supported on wayland"); 1550 sway_log(L_ERROR, "warning: tray_output is not supported on wayland");
1527 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 1551 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
@@ -1585,7 +1609,7 @@ static struct cmd_handler bar_handlers[] = {
1585 { "position", NULL }, 1609 { "position", NULL },
1586 { "seperator_symbol", NULL }, 1610 { "seperator_symbol", NULL },
1587 { "status_command", NULL }, 1611 { "status_command", NULL },
1588 { "strip_workspace_numbers", NULL }, 1612 { "strip_workspace_numbers", bar_cmd_strip_workspace_numbers },
1589 { "tray_output", bar_cmd_tray_output }, 1613 { "tray_output", bar_cmd_tray_output },
1590 { "tray_padding", bar_cmd_tray_padding }, 1614 { "tray_padding", bar_cmd_tray_padding },
1591 { "workspace_buttons", bar_cmd_workspace_buttons }, 1615 { "workspace_buttons", bar_cmd_workspace_buttons },