### Control Mouse with Keyboard
bindsym $mod+KP_2 seat "*" cursor move 0 10
bindsym $mod+KP_8 seat "*" cursor move 0 -10
bindsym $mod+KP_9 seat "*" cursor move 10 -10
bindsym $mod+KP_7 seat "*" cursor move -10 -10
bindsym $mod+KP_4 seat "*" cursor move -10 0
bindsym $mod+KP_1 seat "*" cursor move -10 10
bindsym $mod+KP_3 seat "*" cursor move 10 10
bindsym $mod+KP_6 seat "*" cursor move 10 0
bindsym $mod+KP_5 seat "*" cursor press button1; seat "*" cursor release button1
For the life of me i cannot simulate a mouse click with my keyboard, when i press the cursor kb hotkey it seems like the mouse click is working, but it doesnt do anything.
swaymsg seat "" cursor press button1 && swaymsg seat "" cursor release button1
works fine for me. you wouldn't want ; here because you don't want the actions to occur at the same time, && does it when the last action completes.
Can you switch tabs in Firefox with KB emulated mouse clicks?
The click actions get generated fine, the issue you're facing is that they get sent while $mod is still pressed, and $mod+button1 is the shortcut for moving windows around. You briefly start moving the window under the cursor (so the cursor flashes to the hand grab icon) before releasing it.
Ohh, that explains why I had no such issue, as I have my floating modifier set otherwise.
Closing as a configuration issue, since Sway's behavior here is correct (even if perhaps surprising, in this case) and the events are being generated.
omg thx so much for this clarification!!!!
Actually i changed to:
KP_2 seat "*" cursor move 0 10
KP_8 seat "*" cursor move 0 -10
KP_9 seat "*" cursor move 10 -10
KP_7 seat "*" cursor move -10 -10
KP_4 seat "*" cursor move -10 0
KP_1 seat "*" cursor move -10 10
KP_3 seat "*" cursor move 10 10
KP_6 seat "*" cursor move 10 0
KP_5 seat "*" cursor press button1; seat "*" cursor release button1
For testing and it still doesnt work properly (click only).
Both
bindsym KP_5 seat "*" cursor press button1
bindsym --release KP_5 seat "*" cursor release button1
and
bindsym KP_5 exec swaymsg seat "*" cursor press button1 && swaymsg seat "*" cursor release button1
work for me. I'm pretty sure chaining multiple commands per bindsym is not supported: https://github.com/swaywm/sway/blob/2bf14cb747154251b754fecc004bd568e3f80470/sway/sway.5.scd#L380-L382
Ok new issue mouse click works with:
bindsym KP_5 seat "*" cursor press button1
bindsym --release KP_5 seat "*" cursor release button1
but only if i move the mouse with the actual mouse on where i want to click.
if i use:
bindsym KP_2 seat "*" cursor move 0 10
bindsym KP_8 seat "*" cursor move 0 -10
bindsym KP_9 seat "*" cursor move 10 -10
bindsym KP_7 seat "*" cursor move -10 -10
bindsym KP_4 seat "*" cursor move -10 0
bindsym KP_1 seat "*" cursor move -10 10
bindsym KP_3 seat "*" cursor move 10 10
bindsym KP_6 seat "*" cursor move 10 0
to navigate and then click with keyboard it clicks on last location i left the mouse before controlling it with kb.
This works for me on sway master. https://github.com/swaywm/sway/commit/6ea45395c70939a6d855736cabfe75ad9cf4a0ae (https://github.com/swaywm/sway/pull/5370) went in yesterday fixing an unrelated issue, but it seems it fixes this as well.
ok i ll test when i can thx.
I'm pretty sure chaining multiple commands per bindsym is not supported
Just as a note, this is supported. See execute_command in sway/commands.c and seat_execute_command in sway/commands/bind.c for implementation.
As for this issue itself, I'm going to reopen this. The seat_cmd_cursor subcommands are missing the wl_pointer.frame event. Working on a PR to fix now.