diff options
author | 2015-12-14 15:12:05 +0100 | |
---|---|---|
committer | 2015-12-14 15:15:07 +0100 | |
commit | bd0c58e85a2b6c0e7541e7270e6d7bcca940d7ed (patch) | |
tree | 4413e53577afd6378681264bbbe9d48fab0137fd /sway | |
parent | Implement bar option: strip_workspace_numbers <yes|no> (diff) | |
download | sway-bd0c58e85a2b6c0e7541e7270e6d7bcca940d7ed.tar.gz sway-bd0c58e85a2b6c0e7541e7270e6d7bcca940d7ed.tar.zst sway-bd0c58e85a2b6c0e7541e7270e6d7bcca940d7ed.zip |
Implement bar option: position <top|bottom|left|right>
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/sway/commands.c b/sway/commands.c index f5593b05..5372d3e9 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -64,6 +64,7 @@ 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 | 66 | ||
67 | static sway_cmd bar_cmd_position; | ||
67 | static sway_cmd bar_cmd_strip_workspace_numbers; | 68 | static sway_cmd bar_cmd_strip_workspace_numbers; |
68 | static sway_cmd bar_cmd_tray_output; | 69 | static sway_cmd bar_cmd_tray_output; |
69 | static sway_cmd bar_cmd_tray_padding; | 70 | static sway_cmd bar_cmd_tray_padding; |
@@ -1523,6 +1524,33 @@ static struct cmd_handler handlers[] = { | |||
1523 | { "workspace_auto_back_and_forth", cmd_ws_auto_back_and_forth }, | 1524 | { "workspace_auto_back_and_forth", cmd_ws_auto_back_and_forth }, |
1524 | }; | 1525 | }; |
1525 | 1526 | ||
1527 | static struct cmd_results *bar_cmd_position(int argc, char **argv) { | ||
1528 | struct cmd_results *error = NULL; | ||
1529 | if ((error = checkarg(argc, "position", EXPECTED_EQUAL_TO, 1))) { | ||
1530 | return error; | ||
1531 | } | ||
1532 | |||
1533 | if (!config->current_bar) { | ||
1534 | return cmd_results_new(CMD_FAILURE, "position", "No bar defined."); | ||
1535 | } | ||
1536 | |||
1537 | if (strcasecmp("top", argv[0]) == 0) { | ||
1538 | config->current_bar->position = DESKTOP_SHELL_PANEL_POSITION_TOP; | ||
1539 | } else if (strcasecmp("bottom", argv[0]) == 0) { | ||
1540 | config->current_bar->position = DESKTOP_SHELL_PANEL_POSITION_BOTTOM; | ||
1541 | } else if (strcasecmp("left", argv[0]) == 0) { | ||
1542 | config->current_bar->position = DESKTOP_SHELL_PANEL_POSITION_LEFT; | ||
1543 | } else if (strcasecmp("right", argv[0]) == 0) { | ||
1544 | config->current_bar->position = DESKTOP_SHELL_PANEL_POSITION_RIGHT; | ||
1545 | } else { | ||
1546 | error = cmd_results_new(CMD_INVALID, "position", "Invalid value %s", argv[0]); | ||
1547 | return error; | ||
1548 | } | ||
1549 | |||
1550 | sway_log(L_DEBUG, "Setting bar position '%s'", argv[0]); | ||
1551 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
1552 | } | ||
1553 | |||
1526 | static struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) { | 1554 | static struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) { |
1527 | struct cmd_results *error = NULL; | 1555 | struct cmd_results *error = NULL; |
1528 | if ((error = checkarg(argc, "strip_workspace_numbers", EXPECTED_EQUAL_TO, 1))) { | 1556 | if ((error = checkarg(argc, "strip_workspace_numbers", EXPECTED_EQUAL_TO, 1))) { |
@@ -1606,7 +1634,7 @@ static struct cmd_handler bar_handlers[] = { | |||
1606 | { "mode", NULL }, | 1634 | { "mode", NULL }, |
1607 | { "modifier", NULL }, | 1635 | { "modifier", NULL }, |
1608 | { "output", NULL }, | 1636 | { "output", NULL }, |
1609 | { "position", NULL }, | 1637 | { "position", bar_cmd_position }, |
1610 | { "seperator_symbol", NULL }, | 1638 | { "seperator_symbol", NULL }, |
1611 | { "status_command", NULL }, | 1639 | { "status_command", NULL }, |
1612 | { "strip_workspace_numbers", bar_cmd_strip_workspace_numbers }, | 1640 | { "strip_workspace_numbers", bar_cmd_strip_workspace_numbers }, |