diff options
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/sway/commands.c b/sway/commands.c index d05a9069..6eb383ba 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -65,6 +65,7 @@ static sway_cmd cmd_sticky; | |||
65 | static sway_cmd cmd_workspace; | 65 | static sway_cmd cmd_workspace; |
66 | static sway_cmd cmd_ws_auto_back_and_forth; | 66 | static sway_cmd cmd_ws_auto_back_and_forth; |
67 | 67 | ||
68 | static sway_cmd bar_cmd_binding_mode_indicator; | ||
68 | static sway_cmd bar_cmd_bindsym; | 69 | static sway_cmd bar_cmd_bindsym; |
69 | static sway_cmd bar_cmd_colors; | 70 | static sway_cmd bar_cmd_colors; |
70 | static sway_cmd bar_cmd_mode; | 71 | static sway_cmd bar_cmd_mode; |
@@ -1542,6 +1543,29 @@ static struct cmd_handler handlers[] = { | |||
1542 | { "workspace_auto_back_and_forth", cmd_ws_auto_back_and_forth }, | 1543 | { "workspace_auto_back_and_forth", cmd_ws_auto_back_and_forth }, |
1543 | }; | 1544 | }; |
1544 | 1545 | ||
1546 | static struct cmd_results *bar_cmd_binding_mode_indicator(int argc, char **argv) { | ||
1547 | struct cmd_results *error = NULL; | ||
1548 | if ((error = checkarg(argc, "binding_mode_indicator", EXPECTED_EQUAL_TO, 1))) { | ||
1549 | return error; | ||
1550 | } | ||
1551 | |||
1552 | if (!config->current_bar) { | ||
1553 | return cmd_results_new(CMD_FAILURE, "binding_mode_indicator", "No bar defined."); | ||
1554 | } | ||
1555 | |||
1556 | if (strcasecmp("yes", argv[0]) == 0) { | ||
1557 | config->current_bar->binding_mode_indicator = true; | ||
1558 | sway_log(L_DEBUG, "Enabling binding mode indicator on bar: %s", config->current_bar->id); | ||
1559 | } else if (strcasecmp("no", argv[0]) == 0) { | ||
1560 | config->current_bar->binding_mode_indicator = false; | ||
1561 | sway_log(L_DEBUG, "Disabling binding mode indicator on bar: %s", config->current_bar->id); | ||
1562 | } else { | ||
1563 | error = cmd_results_new(CMD_INVALID, "binding_mode_indicator", "Invalid value %s", argv[0]); | ||
1564 | return error; | ||
1565 | } | ||
1566 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
1567 | } | ||
1568 | |||
1545 | static struct cmd_results *bar_cmd_bindsym(int argc, char **argv) { | 1569 | static struct cmd_results *bar_cmd_bindsym(int argc, char **argv) { |
1546 | struct cmd_results *error = NULL; | 1570 | struct cmd_results *error = NULL; |
1547 | if ((error = checkarg(argc, "bindsym", EXPECTED_MORE_THAN, 1))) { | 1571 | if ((error = checkarg(argc, "bindsym", EXPECTED_MORE_THAN, 1))) { |
@@ -1887,7 +1911,7 @@ static struct cmd_results *bar_cmd_workspace_buttons(int argc, char **argv) { | |||
1887 | } | 1911 | } |
1888 | 1912 | ||
1889 | static struct cmd_handler bar_handlers[] = { | 1913 | static struct cmd_handler bar_handlers[] = { |
1890 | { "binding_mode_indicator", NULL }, | 1914 | { "binding_mode_indicator", bar_cmd_binding_mode_indicator }, |
1891 | { "bindsym", bar_cmd_bindsym }, | 1915 | { "bindsym", bar_cmd_bindsym }, |
1892 | { "colors", bar_cmd_colors }, | 1916 | { "colors", bar_cmd_colors }, |
1893 | { "font", NULL }, | 1917 | { "font", NULL }, |