summaryrefslogtreecommitdiffstats
path: root/sway/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 332d3888..79591925 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -1149,6 +1149,29 @@ static void input_cmd_apply(struct input_config *input) {
1149 } 1149 }
1150} 1150}
1151 1151
1152static struct cmd_results *input_cmd_accel_profile(int argc, char **argv) {
1153 struct cmd_results *error = NULL;
1154 if ((error = checkarg(argc, "accel_profile", EXPECTED_AT_LEAST, 1))) {
1155 return error;
1156 }
1157 if (!current_input_config) {
1158 return cmd_results_new(CMD_FAILURE, "accel_profile", "No input device defined.");
1159 }
1160 struct input_config *new_config = new_input_config(current_input_config->identifier);
1161
1162 if (strcasecmp(argv[0], "adaptive") == 0) {
1163 new_config->accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
1164 } else if (strcasecmp(argv[0], "flat") == 0) {
1165 new_config->accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
1166 } else {
1167 return cmd_results_new(CMD_INVALID, "accel_profile",
1168 "Expected 'accel_profile <adaptive|flat>'");
1169 }
1170
1171 input_cmd_apply(new_config);
1172 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
1173}
1174
1152static struct cmd_results *input_cmd_click_method(int argc, char **argv) { 1175static struct cmd_results *input_cmd_click_method(int argc, char **argv) {
1153 sway_log(L_DEBUG, "click_method for device: %d %s", current_input_config==NULL, current_input_config->identifier); 1176 sway_log(L_DEBUG, "click_method for device: %d %s", current_input_config==NULL, current_input_config->identifier);
1154 struct cmd_results *error = NULL; 1177 struct cmd_results *error = NULL;
@@ -1388,7 +1411,9 @@ static struct cmd_results *cmd_input(int argc, char **argv) {
1388 1411
1389 struct cmd_results *res; 1412 struct cmd_results *res;
1390 current_input_config = new_input_config(argv[0]); 1413 current_input_config = new_input_config(argv[0]);
1391 if (strcasecmp("click_method", argv[1]) == 0) { 1414 if (strcasecmp("accel_profile", argv[1]) == 0) {
1415 res = input_cmd_accel_profile(argc_new, argv_new);
1416 } else if (strcasecmp("click_method", argv[1]) == 0) {
1392 res = input_cmd_click_method(argc_new, argv_new); 1417 res = input_cmd_click_method(argc_new, argv_new);
1393 } else if (strcasecmp("drag_lock", argv[1]) == 0) { 1418 } else if (strcasecmp("drag_lock", argv[1]) == 0) {
1394 res = input_cmd_drag_lock(argc_new, argv_new); 1419 res = input_cmd_drag_lock(argc_new, argv_new);
@@ -1407,7 +1432,7 @@ static struct cmd_results *cmd_input(int argc, char **argv) {
1407 } else if (strcasecmp("tap", argv[1]) == 0) { 1432 } else if (strcasecmp("tap", argv[1]) == 0) {
1408 res = input_cmd_tap(argc_new, argv_new); 1433 res = input_cmd_tap(argc_new, argv_new);
1409 } else { 1434 } else {
1410 res = cmd_results_new(CMD_INVALID, "input <device>", "Unknonwn command %s", argv[1]); 1435 res = cmd_results_new(CMD_INVALID, "input <device>", "Unknown command %s", argv[1]);
1411 } 1436 }
1412 current_input_config = NULL; 1437 current_input_config = NULL;
1413 return res; 1438 return res;
@@ -3127,6 +3152,7 @@ static struct cmd_results *bar_colors_cmd_urgent_workspace(int argc, char **argv
3127} 3152}
3128 3153
3129static struct cmd_handler input_handlers[] = { 3154static struct cmd_handler input_handlers[] = {
3155 { "accel_profile", input_cmd_accel_profile },
3130 { "click_method", input_cmd_click_method }, 3156 { "click_method", input_cmd_click_method },
3131 { "drag_lock", input_cmd_drag_lock }, 3157 { "drag_lock", input_cmd_drag_lock },
3132 { "dwt", input_cmd_dwt }, 3158 { "dwt", input_cmd_dwt },