Added workspace_gesture_spring_size config option
This commit is contained in:
parent
3480479f17
commit
519bfc4ecc
|
@ -230,6 +230,7 @@ sway_cmd cmd_urgent;
|
||||||
sway_cmd cmd_workspace;
|
sway_cmd cmd_workspace;
|
||||||
sway_cmd cmd_workspace_layout;
|
sway_cmd cmd_workspace_layout;
|
||||||
sway_cmd cmd_ws_auto_back_and_forth;
|
sway_cmd cmd_ws_auto_back_and_forth;
|
||||||
|
sway_cmd cmd_ws_gesture_spring_size;
|
||||||
sway_cmd cmd_xwayland;
|
sway_cmd cmd_xwayland;
|
||||||
|
|
||||||
sway_cmd bar_cmd_bindcode;
|
sway_cmd bar_cmd_bindcode;
|
||||||
|
|
|
@ -507,6 +507,8 @@ struct sway_config {
|
||||||
bool titlebar_separator;
|
bool titlebar_separator;
|
||||||
bool scratchpad_minimize;
|
bool scratchpad_minimize;
|
||||||
|
|
||||||
|
int workspace_gesture_spring_size;
|
||||||
|
|
||||||
list_t *layer_criteria;
|
list_t *layer_criteria;
|
||||||
|
|
||||||
char *swaynag_command;
|
char *swaynag_command;
|
||||||
|
|
|
@ -122,6 +122,7 @@ static const struct cmd_handler handlers[] = {
|
||||||
{ "unbindworkspacegesture", cmd_unbindworkspacegesture },
|
{ "unbindworkspacegesture", cmd_unbindworkspacegesture },
|
||||||
{ "workspace", cmd_workspace },
|
{ "workspace", cmd_workspace },
|
||||||
{ "workspace_auto_back_and_forth", cmd_ws_auto_back_and_forth },
|
{ "workspace_auto_back_and_forth", cmd_ws_auto_back_and_forth },
|
||||||
|
{ "workspace_gesture_spring_size", cmd_ws_gesture_spring_size },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Config-time only commands. Keep alphabetized */
|
/* Config-time only commands. Keep alphabetized */
|
||||||
|
|
20
sway/commands/workspace_gesture.c
Normal file
20
sway/commands/workspace_gesture.c
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#define _POSIX_C_SOURCE 200809L
|
||||||
|
#include "sway/commands.h"
|
||||||
|
#include "sway/config.h"
|
||||||
|
|
||||||
|
struct cmd_results *cmd_ws_gesture_spring_size(int argc, char **argv) {
|
||||||
|
struct cmd_results *error = NULL;
|
||||||
|
if ((error = checkarg(argc, "workspace_gesture_spring_size", EXPECTED_EQUAL_TO, 1))) {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *inv;
|
||||||
|
int value = strtol(argv[0], &inv, 10);
|
||||||
|
if (*inv != '\0' || value < 0 || value > 250) {
|
||||||
|
return cmd_results_new(CMD_FAILURE, "Invalid size specified");
|
||||||
|
}
|
||||||
|
|
||||||
|
config->workspace_gesture_spring_size = value;
|
||||||
|
|
||||||
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||||
|
}
|
|
@ -368,6 +368,8 @@ static void config_defaults(struct sway_config *config) {
|
||||||
config->titlebar_separator = true;
|
config->titlebar_separator = true;
|
||||||
config->scratchpad_minimize = false;
|
config->scratchpad_minimize = false;
|
||||||
|
|
||||||
|
config->workspace_gesture_spring_size = 50;
|
||||||
|
|
||||||
if (!(config->layer_criteria = create_list())) goto cleanup;
|
if (!(config->layer_criteria = create_list())) goto cleanup;
|
||||||
|
|
||||||
// The keysym to keycode translation
|
// The keysym to keycode translation
|
||||||
|
|
|
@ -1136,7 +1136,8 @@ void update_workspace_scroll_percent(struct sway_seat *seat, int gesture_percent
|
||||||
// TODO: Make configurable?
|
// TODO: Make configurable?
|
||||||
// Visualized to the user that this is the last / first workspace by
|
// Visualized to the user that this is the last / first workspace by
|
||||||
// allowing a small swipe, a "Spring effect"
|
// allowing a small swipe, a "Spring effect"
|
||||||
float spring_limit = (float) 50 / output->width * output->wlr_output->scale;
|
float spring_limit = (float) config->workspace_gesture_spring_size /
|
||||||
|
output->width * output->wlr_output->scale;
|
||||||
// Make sure that the limit is always smaller than the threshold
|
// Make sure that the limit is always smaller than the threshold
|
||||||
spring_limit = MIN(THRESHOLD, spring_limit);
|
spring_limit = MIN(THRESHOLD, spring_limit);
|
||||||
// Limit the percent depending on if the workspace is the first/last or in
|
// Limit the percent depending on if the workspace is the first/last or in
|
||||||
|
|
|
@ -127,7 +127,7 @@ sway_sources = files(
|
||||||
'commands/set.c',
|
'commands/set.c',
|
||||||
'commands/shadow_blur_radius.c',
|
'commands/shadow_blur_radius.c',
|
||||||
'commands/shadow_color.c',
|
'commands/shadow_color.c',
|
||||||
'commands/shadow_offset.c',
|
'commands/shadow_offset.c',
|
||||||
'commands/shadow_inactive_color.c',
|
'commands/shadow_inactive_color.c',
|
||||||
'commands/shadows.c',
|
'commands/shadows.c',
|
||||||
'commands/shadows_on_csd.c',
|
'commands/shadows_on_csd.c',
|
||||||
|
@ -149,6 +149,7 @@ sway_sources = files(
|
||||||
'commands/unmark.c',
|
'commands/unmark.c',
|
||||||
'commands/urgent.c',
|
'commands/urgent.c',
|
||||||
'commands/workspace.c',
|
'commands/workspace.c',
|
||||||
|
'commands/workspace_gesture.c',
|
||||||
'commands/workspace_layout.c',
|
'commands/workspace_layout.c',
|
||||||
'commands/ws_auto_back_and_forth.c',
|
'commands/ws_auto_back_and_forth.c',
|
||||||
'commands/xwayland.c',
|
'commands/xwayland.c',
|
||||||
|
|
|
@ -588,6 +588,10 @@ runtime.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
*workspace_gesture_spring_size* <value>
|
||||||
|
Adjusts the workspace gestures spring size. Can use values between
|
||||||
|
0 (disabled) and 100 while 50 is the default value.
|
||||||
|
|
||||||
*client.background* <color>
|
*client.background* <color>
|
||||||
This command is ignored and is only present for i3 compatibility.
|
This command is ignored and is only present for i3 compatibility.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue