aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
Diffstat (limited to 'sway')
-rw-r--r--sway/commands.c25
-rw-r--r--sway/ipc-json.c1
-rw-r--r--sway/sway-bar.5.txt9
3 files changed, 32 insertions, 3 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 },
};
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index e7ab988c..ca45557c 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -241,6 +241,7 @@ json_object *ipc_json_describe_bar_config(struct bar_config *bar) {
json_object_object_add(json, "separator_symbol", json_object_new_string(bar->separator_symbol));
}
json_object_object_add(json, "bar_height", json_object_new_int(bar->height));
+ json_object_object_add(json, "wrap_scroll", json_object_new_boolean(bar->wrap_scroll));
json_object_object_add(json, "workspace_buttons", json_object_new_boolean(bar->workspace_buttons));
json_object_object_add(json, "strip_workspace_numbers", json_object_new_boolean(bar->strip_workspace_numbers));
json_object_object_add(json, "binding_mode_indicator", json_object_new_boolean(bar->binding_mode_indicator));
diff --git a/sway/sway-bar.5.txt b/sway/sway-bar.5.txt
index dc4a673c..a404acd0 100644
--- a/sway/sway-bar.5.txt
+++ b/sway/sway-bar.5.txt
@@ -21,7 +21,7 @@ Commands
**status_command** <status command>::
Executes the bar _status command_ with _sh -c_. Each line of text printed to
stdout from this command will be displayed in the status area of the bar. You
- can also use the i3bar JSON protocol:
+ may also use the i3bar JSON protocol:
+
https://i3wm.org/docs/i3bar-protocol.html
@@ -48,9 +48,12 @@ Commands
**separator_symbol** <symbol>::
Specifies the separator symbol to separate blocks on the bar.
+**wrap_scroll** <yes|no>::
+ Enables or disables wrapping when scrolling through workspaces with the
+ scroll wheel. Default is no.
+
**workspace_buttons** <yes|no>::
- Enables or disables workspace buttons on the bar. Default is to enable
- buttons.
+ Enables or disables workspace buttons on the bar. Default is yes.
**strip_workspace_numbers** <yes|no>::
If set to _yes_, then workspace numbers will be omitted from the workspace