mirror of
https://github.com/swaywm/sway.git
synced 2026-04-21 06:46:22 -04:00
This allows to better support certain pop-ups which require focus or they close (like certain password managers).
The popup can be marked and only that window will get mouse_warped.
For example:
```
for_window [title="Enpass Assistant"] {
move position mouse
inhibit_idle visible
urgent enable
mark --add mouse_me
}
mouse_warping mark mouse_me
```
27 lines
918 B
C
27 lines
918 B
C
#include <string.h>
|
|
#include <strings.h>
|
|
#include "sway/commands.h"
|
|
|
|
struct cmd_results *cmd_mouse_warping(int argc, char **argv) {
|
|
struct cmd_results *error = NULL;
|
|
if ((error = checkarg(argc, "mouse_warping", EXPECTED_AT_LEAST, 1))) {
|
|
return error;
|
|
} else if (strcasecmp(argv[0], "container") == 0) {
|
|
config->mouse_warping = WARP_CONTAINER;
|
|
} else if (strcasecmp(argv[0], "output") == 0) {
|
|
config->mouse_warping = WARP_OUTPUT;
|
|
} else if (strcasecmp(argv[0], "none") == 0) {
|
|
config->mouse_warping = WARP_NO;
|
|
} else if (strcasecmp(argv[0], "mark") == 0) {
|
|
config->mouse_warping = WARP_MARK;
|
|
if (argc < 2) {
|
|
return cmd_results_new(CMD_FAILURE, "Expected an mark name as a second argument");
|
|
}
|
|
config->mouse_warping_mark_name = argv[1];
|
|
} else {
|
|
return cmd_results_new(CMD_FAILURE,
|
|
"Expected 'mouse_warping output|container|mark|none'");
|
|
}
|
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
|
}
|
|
|