diff options
author | 2015-12-13 23:33:54 +0100 | |
---|---|---|
committer | 2015-12-14 12:56:59 +0100 | |
commit | b9e8accc51188976cf8ce4710841425b161b9b3f (patch) | |
tree | 6136395681e01bcbcb759b587b9d836a1f58266d /sway/commands.c | |
parent | Implement 'bar { }' block parsing (diff) | |
download | sway-b9e8accc51188976cf8ce4710841425b161b9b3f.tar.gz sway-b9e8accc51188976cf8ce4710841425b161b9b3f.tar.zst sway-b9e8accc51188976cf8ce4710841425b161b9b3f.zip |
Implement bar option: workspace_buttons <yes|no>
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/sway/commands.c b/sway/commands.c index d6da1de3..cefad2ef 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -63,6 +63,7 @@ static sway_cmd cmd_splitv; | |||
63 | static sway_cmd cmd_sticky; | 63 | static sway_cmd cmd_sticky; |
64 | static sway_cmd cmd_workspace; | 64 | static sway_cmd cmd_workspace; |
65 | static sway_cmd cmd_ws_auto_back_and_forth; | 65 | static sway_cmd cmd_ws_auto_back_and_forth; |
66 | static sway_cmd bar_cmd_workspace_buttons; | ||
66 | 67 | ||
67 | swayc_t *sp_view; | 68 | swayc_t *sp_view; |
68 | int sp_index = 0; | 69 | int sp_index = 0; |
@@ -1518,6 +1519,27 @@ static struct cmd_handler handlers[] = { | |||
1518 | { "workspace_auto_back_and_forth", cmd_ws_auto_back_and_forth }, | 1519 | { "workspace_auto_back_and_forth", cmd_ws_auto_back_and_forth }, |
1519 | }; | 1520 | }; |
1520 | 1521 | ||
1522 | static struct cmd_results *bar_cmd_workspace_buttons(int argc, char **argv) { | ||
1523 | struct cmd_results *error = NULL; | ||
1524 | if ((error = checkarg(argc, "workspace_buttons", EXPECTED_EQUAL_TO, 1))) { | ||
1525 | return error; | ||
1526 | } | ||
1527 | |||
1528 | if (!config->current_bar) { | ||
1529 | return cmd_results_new(CMD_FAILURE, "workspace_buttons", "No bar defined."); | ||
1530 | } | ||
1531 | |||
1532 | if (strcasecmp("yes", argv[0]) == 0) { | ||
1533 | config->current_bar->workspace_buttons = true; | ||
1534 | } else if (strcasecmp("no", argv[0]) == 0) { | ||
1535 | config->current_bar->workspace_buttons = false; | ||
1536 | } else { | ||
1537 | error = cmd_results_new(CMD_INVALID, "workspace_buttons", "Invalid value %s", argv[0]); | ||
1538 | return error; | ||
1539 | } | ||
1540 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
1541 | } | ||
1542 | |||
1521 | static struct cmd_handler bar_handlers[] = { | 1543 | static struct cmd_handler bar_handlers[] = { |
1522 | { "binding_mode_indicator", NULL }, | 1544 | { "binding_mode_indicator", NULL }, |
1523 | { "bindsym", NULL }, | 1545 | { "bindsym", NULL }, |
@@ -1534,7 +1556,7 @@ static struct cmd_handler bar_handlers[] = { | |||
1534 | { "strip_workspace_numbers", NULL }, | 1556 | { "strip_workspace_numbers", NULL }, |
1535 | { "tray_output", NULL }, | 1557 | { "tray_output", NULL }, |
1536 | { "tray_padding", NULL }, | 1558 | { "tray_padding", NULL }, |
1537 | { "workspace_buttons", NULL }, | 1559 | { "workspace_buttons", bar_cmd_workspace_buttons }, |
1538 | }; | 1560 | }; |
1539 | 1561 | ||
1540 | static int handler_compare(const void *_a, const void *_b) { | 1562 | static int handler_compare(const void *_a, const void *_b) { |