aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorMikkel Oscar Lyderik <mikkeloscar@gmail.com>2015-12-14 15:12:05 +0100
committerMikkel Oscar Lyderik <mikkeloscar@gmail.com>2015-12-14 15:15:07 +0100
commitbd0c58e85a2b6c0e7541e7270e6d7bcca940d7ed (patch)
tree4413e53577afd6378681264bbbe9d48fab0137fd /sway
parentcc08daded412966ba9068ad9ac63c5adea9ef5d4 (diff)
Implement bar option: position <top|bottom|left|right>
Diffstat (limited to 'sway')
-rw-r--r--sway/commands.c30
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;
static sway_cmd cmd_workspace;
static sway_cmd cmd_ws_auto_back_and_forth;
+static sway_cmd bar_cmd_position;
static sway_cmd bar_cmd_strip_workspace_numbers;
static sway_cmd bar_cmd_tray_output;
static sway_cmd bar_cmd_tray_padding;
@@ -1523,6 +1524,33 @@ static struct cmd_handler handlers[] = {
{ "workspace_auto_back_and_forth", cmd_ws_auto_back_and_forth },
};
+static struct cmd_results *bar_cmd_position(int argc, char **argv) {
+ struct cmd_results *error = NULL;
+ if ((error = checkarg(argc, "position", EXPECTED_EQUAL_TO, 1))) {
+ return error;
+ }
+
+ if (!config->current_bar) {
+ return cmd_results_new(CMD_FAILURE, "position", "No bar defined.");
+ }
+
+ if (strcasecmp("top", argv[0]) == 0) {
+ config->current_bar->position = DESKTOP_SHELL_PANEL_POSITION_TOP;
+ } else if (strcasecmp("bottom", argv[0]) == 0) {
+ config->current_bar->position = DESKTOP_SHELL_PANEL_POSITION_BOTTOM;
+ } else if (strcasecmp("left", argv[0]) == 0) {
+ config->current_bar->position = DESKTOP_SHELL_PANEL_POSITION_LEFT;
+ } else if (strcasecmp("right", argv[0]) == 0) {
+ config->current_bar->position = DESKTOP_SHELL_PANEL_POSITION_RIGHT;
+ } else {
+ error = cmd_results_new(CMD_INVALID, "position", "Invalid value %s", argv[0]);
+ return error;
+ }
+
+ sway_log(L_DEBUG, "Setting bar position '%s'", argv[0]);
+ return cmd_results_new(CMD_SUCCESS, NULL, NULL);
+}
+
static struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) {
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "strip_workspace_numbers", EXPECTED_EQUAL_TO, 1))) {
@@ -1606,7 +1634,7 @@ static struct cmd_handler bar_handlers[] = {
{ "mode", NULL },
{ "modifier", NULL },
{ "output", NULL },
- { "position", NULL },
+ { "position", bar_cmd_position },
{ "seperator_symbol", NULL },
{ "status_command", NULL },
{ "strip_workspace_numbers", bar_cmd_strip_workspace_numbers },