mirror of
https://github.com/swaywm/sway.git
synced 2025-11-06 13:29:50 -05:00
Make mouse key used for drag/resize configurable
This makes it possible to define what mouse button key (left|right) to use for dragging/resizing.
This commit is contained in:
parent
a7710c5537
commit
22916e9ebc
4 changed files with 93 additions and 21 deletions
|
|
@ -375,14 +375,14 @@ static struct cmd_results *cmd_floating(int argc, char **argv) {
|
|||
|
||||
static struct cmd_results *cmd_floating_mod(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "floating_modifier", EXPECTED_EQUAL_TO, 1))) {
|
||||
if ((error = checkarg(argc, "floating_modifier", EXPECTED_AT_LEAST, 1))) {
|
||||
return error;
|
||||
}
|
||||
int i, j;
|
||||
list_t *split = split_string(argv[0], "+");
|
||||
config->floating_mod = 0;
|
||||
|
||||
// set modifer keys
|
||||
// set modifier keys
|
||||
for (i = 0; i < split->length; ++i) {
|
||||
for (j = 0; j < (int)(sizeof(modifiers) / sizeof(struct modifier_key)); ++j) {
|
||||
if (strcasecmp(modifiers[j].name, split->items[i]) == 0) {
|
||||
|
|
@ -395,6 +395,19 @@ static struct cmd_results *cmd_floating_mod(int argc, char **argv) {
|
|||
error = cmd_results_new(CMD_INVALID, "floating_modifier", "Unknown keys %s", argv[0]);
|
||||
return error;
|
||||
}
|
||||
|
||||
if (argc >= 2) {
|
||||
if (strcasecmp("inverse", argv[1]) == 0) {
|
||||
config->dragging_key = M_RIGHT_CLICK;
|
||||
config->resizing_key = M_LEFT_CLICK;
|
||||
} else if (strcasecmp("normal", argv[1]) == 0) {
|
||||
config->dragging_key = M_LEFT_CLICK;
|
||||
config->resizing_key = M_RIGHT_CLICK;
|
||||
} else {
|
||||
error = cmd_results_new(CMD_INVALID, "floating_modifier", "Invalid definition %s", argv[1]);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue