diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-12-15 09:08:40 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-12-15 09:08:40 -0500 |
commit | 809c251df81bbdfd0ea13c269c28cd93d57f6e4b (patch) | |
tree | 1735f8f1f804d859eb37d49303d4517ac051fa57 /sway/commands.c | |
parent | 432e3310f65544d46171c4d25ca252fa0cd34ae7 (diff) | |
parent | 6834a33290e7cf9466a3671cb00d3d7b08f68ca7 (diff) |
Merge pull request #328 from mikkeloscar/bar-height
Add bar height option (Airblader/i3)
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sway/commands.c b/sway/commands.c index 733fb293..23e6e68c 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -69,6 +69,7 @@ static sway_cmd bar_cmd_bindsym; static sway_cmd bar_cmd_colors; static sway_cmd bar_cmd_mode; static sway_cmd bar_cmd_modifier; +static sway_cmd bar_cmd_height; static sway_cmd bar_cmd_hidden_state; static sway_cmd bar_cmd_id; static sway_cmd bar_cmd_position; @@ -1592,6 +1593,23 @@ static struct cmd_results *bar_cmd_colors(int argc, char **argv) { return cmd_results_new(CMD_BLOCK_BAR_COLORS, NULL, NULL); } +static struct cmd_results *bar_cmd_height(int argc, char **argv) { + struct cmd_results *error = NULL; + if ((error = checkarg(argc, "height", EXPECTED_EQUAL_TO, 1))) { + return error; + } + + int height = atoi(argv[0]); + if (height < 0) { + return cmd_results_new(CMD_INVALID, "height", + "Invalid height value: %s", argv[0]); + } + + config->current_bar->height = height; + sway_log(L_DEBUG, "Setting bar height to %d on bar: %s", height, config->current_bar->id); + return cmd_results_new(CMD_SUCCESS, NULL, NULL); +} + static struct cmd_results *bar_cmd_hidden_state(int argc, char **argv) { struct cmd_results *error = NULL; if ((error = checkarg(argc, "hidden_state", EXPECTED_EQUAL_TO, 1))) { @@ -1831,6 +1849,7 @@ static struct cmd_handler bar_handlers[] = { { "bindsym", bar_cmd_bindsym }, { "colors", bar_cmd_colors }, { "font", NULL }, + { "height", bar_cmd_height }, { "hidden_state", bar_cmd_hidden_state }, { "id", bar_cmd_id }, { "mode", bar_cmd_mode }, |