summaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2016-07-17 11:26:38 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2016-07-17 11:26:38 -0400
commit3bb880bf207b40bc0cddcb9c449a738861e6791b (patch)
tree66ed13164fef27ebf3c8a6106590f1b7ec432483 /sway
parentAllow users to customize the cursor on clients (diff)
downloadsway-3bb880bf207b40bc0cddcb9c449a738861e6791b.tar.gz
sway-3bb880bf207b40bc0cddcb9c449a738861e6791b.tar.zst
sway-3bb880bf207b40bc0cddcb9c449a738861e6791b.zip
Implement configurable wrapping on bar ws scroll
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;
114static sway_cmd bar_cmd_swaybar_command; 114static sway_cmd bar_cmd_swaybar_command;
115static sway_cmd bar_cmd_tray_output; 115static sway_cmd bar_cmd_tray_output;
116static sway_cmd bar_cmd_tray_padding; 116static sway_cmd bar_cmd_tray_padding;
117static sway_cmd bar_cmd_wrap_scroll;
117static sway_cmd bar_cmd_workspace_buttons; 118static sway_cmd bar_cmd_workspace_buttons;
118 119
119static sway_cmd bar_colors_cmd_active_workspace; 120static sway_cmd bar_colors_cmd_active_workspace;
@@ -3169,6 +3170,29 @@ static struct cmd_results *bar_cmd_tray_padding(int argc, char **argv) {
3169 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 3170 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
3170} 3171}
3171 3172
3173static struct cmd_results *bar_cmd_wrap_scroll(int argc, char **argv) {
3174 struct cmd_results *error = NULL;
3175 if ((error = checkarg(argc, "wrap_scroll", EXPECTED_EQUAL_TO, 1))) {
3176 return error;
3177 }
3178
3179 if (!config->current_bar) {
3180 return cmd_results_new(CMD_FAILURE, "wrap_scroll", "No bar defined.");
3181 }
3182
3183 if (strcasecmp("yes", argv[0]) == 0) {
3184 config->current_bar->wrap_scroll = true;
3185 sway_log(L_DEBUG, "Enabling wrap scroll on bar: %s", config->current_bar->id);
3186 } else if (strcasecmp("no", argv[0]) == 0) {
3187 config->current_bar->wrap_scroll = false;
3188 sway_log(L_DEBUG, "Disabling wrap scroll on bar: %s", config->current_bar->id);
3189 } else {
3190 error = cmd_results_new(CMD_INVALID, "wrap_scroll", "Invalid value %s", argv[0]);
3191 return error;
3192 }
3193 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
3194}
3195
3172static struct cmd_results *bar_cmd_workspace_buttons(int argc, char **argv) { 3196static struct cmd_results *bar_cmd_workspace_buttons(int argc, char **argv) {
3173 struct cmd_results *error = NULL; 3197 struct cmd_results *error = NULL;
3174 if ((error = checkarg(argc, "workspace_buttons", EXPECTED_EQUAL_TO, 1))) { 3198 if ((error = checkarg(argc, "workspace_buttons", EXPECTED_EQUAL_TO, 1))) {
@@ -3211,6 +3235,7 @@ static struct cmd_handler bar_handlers[] = {
3211 { "swaybar_command", bar_cmd_swaybar_command }, 3235 { "swaybar_command", bar_cmd_swaybar_command },
3212 { "tray_output", bar_cmd_tray_output }, 3236 { "tray_output", bar_cmd_tray_output },
3213 { "tray_padding", bar_cmd_tray_padding }, 3237 { "tray_padding", bar_cmd_tray_padding },
3238 { "wrap_scroll", bar_cmd_wrap_scroll },
3214 { "workspace_buttons", bar_cmd_workspace_buttons }, 3239 { "workspace_buttons", bar_cmd_workspace_buttons },
3215}; 3240};
3216 3241
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) {
241 json_object_object_add(json, "separator_symbol", json_object_new_string(bar->separator_symbol)); 241 json_object_object_add(json, "separator_symbol", json_object_new_string(bar->separator_symbol));
242 } 242 }
243 json_object_object_add(json, "bar_height", json_object_new_int(bar->height)); 243 json_object_object_add(json, "bar_height", json_object_new_int(bar->height));
244 json_object_object_add(json, "wrap_scroll", json_object_new_boolean(bar->wrap_scroll));
244 json_object_object_add(json, "workspace_buttons", json_object_new_boolean(bar->workspace_buttons)); 245 json_object_object_add(json, "workspace_buttons", json_object_new_boolean(bar->workspace_buttons));
245 json_object_object_add(json, "strip_workspace_numbers", json_object_new_boolean(bar->strip_workspace_numbers)); 246 json_object_object_add(json, "strip_workspace_numbers", json_object_new_boolean(bar->strip_workspace_numbers));
246 json_object_object_add(json, "binding_mode_indicator", json_object_new_boolean(bar->binding_mode_indicator)); 247 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
21**status_command** <status command>:: 21**status_command** <status command>::
22 Executes the bar _status command_ with _sh -c_. Each line of text printed to 22 Executes the bar _status command_ with _sh -c_. Each line of text printed to
23 stdout from this command will be displayed in the status area of the bar. You 23 stdout from this command will be displayed in the status area of the bar. You
24 can also use the i3bar JSON protocol: 24 may also use the i3bar JSON protocol:
25 + 25 +
26 https://i3wm.org/docs/i3bar-protocol.html 26 https://i3wm.org/docs/i3bar-protocol.html
27 27
@@ -48,9 +48,12 @@ Commands
48**separator_symbol** <symbol>:: 48**separator_symbol** <symbol>::
49 Specifies the separator symbol to separate blocks on the bar. 49 Specifies the separator symbol to separate blocks on the bar.
50 50
51**wrap_scroll** <yes|no>::
52 Enables or disables wrapping when scrolling through workspaces with the
53 scroll wheel. Default is no.
54
51**workspace_buttons** <yes|no>:: 55**workspace_buttons** <yes|no>::
52 Enables or disables workspace buttons on the bar. Default is to enable 56 Enables or disables workspace buttons on the bar. Default is yes.
53 buttons.
54 57
55**strip_workspace_numbers** <yes|no>:: 58**strip_workspace_numbers** <yes|no>::
56 If set to _yes_, then workspace numbers will be omitted from the workspace 59 If set to _yes_, then workspace numbers will be omitted from the workspace