diff options
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sway/commands.c b/sway/commands.c index b9399dec..73f245c1 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -114,6 +114,7 @@ static sway_cmd bar_cmd_strip_workspace_numbers; static sway_cmd bar_cmd_swaybar_command; static sway_cmd bar_cmd_tray_output; static sway_cmd bar_cmd_tray_padding; +static sway_cmd bar_cmd_wrap_scroll; static sway_cmd bar_cmd_workspace_buttons; static sway_cmd bar_colors_cmd_active_workspace; @@ -3169,6 +3170,29 @@ static struct cmd_results *bar_cmd_tray_padding(int argc, char **argv) { return cmd_results_new(CMD_SUCCESS, NULL, NULL); } +static struct cmd_results *bar_cmd_wrap_scroll(int argc, char **argv) { + struct cmd_results *error = NULL; + if ((error = checkarg(argc, "wrap_scroll", EXPECTED_EQUAL_TO, 1))) { + return error; + } + + if (!config->current_bar) { + return cmd_results_new(CMD_FAILURE, "wrap_scroll", "No bar defined."); + } + + if (strcasecmp("yes", argv[0]) == 0) { + config->current_bar->wrap_scroll = true; + sway_log(L_DEBUG, "Enabling wrap scroll on bar: %s", config->current_bar->id); + } else if (strcasecmp("no", argv[0]) == 0) { + config->current_bar->wrap_scroll = false; + sway_log(L_DEBUG, "Disabling wrap scroll on bar: %s", config->current_bar->id); + } else { + error = cmd_results_new(CMD_INVALID, "wrap_scroll", "Invalid value %s", argv[0]); + return error; + } + return cmd_results_new(CMD_SUCCESS, NULL, NULL); +} + static struct cmd_results *bar_cmd_workspace_buttons(int argc, char **argv) { struct cmd_results *error = NULL; if ((error = checkarg(argc, "workspace_buttons", EXPECTED_EQUAL_TO, 1))) { @@ -3211,6 +3235,7 @@ static struct cmd_handler bar_handlers[] = { { "swaybar_command", bar_cmd_swaybar_command }, { "tray_output", bar_cmd_tray_output }, { "tray_padding", bar_cmd_tray_padding }, + { "wrap_scroll", bar_cmd_wrap_scroll }, { "workspace_buttons", bar_cmd_workspace_buttons }, }; |