sway: Mouse cursor can no longer click on anything or change focus
$ sway --version
sway version 1.0
(but the arch linux package says sway 1.1.1-3)
Sometimes when I am using my sway desktop as usual the mouse cursor stops functioning. The first symptom I notice is that I can no longer scroll and cannot click on the parts of the user interface that are related to sway like the workspaces in swaybar and the window bars in tabbed containers but clicking in other windows still works. The automatic focus switching when moving the cursor to a window also stops working.
After some time of continuing to use the desktop the mouse becomes unable to click on anything at all. I can move the cursor no clicks register anywhere.
In this state I have unsuccessfully tried:
- pressing reload configuration hotkey
- locking and unlocking the screen
- closing all visible applications
Eventually I press the exit sway hotkey. The button asking me to confirm the exit does work with the cursor.
I do not know what causes this problem to appear.
The only mouse related configuration option I use is
input "identifier_of_mouse" {
pointer_accel 0
}
Edit: My original problem was related to faulty input hardware on my side. I am not closing the issue because other errors have been discussed here too.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 16
- Comments: 105 (7 by maintainers)
I have the same issue on 1.8.1, after my last distro upgrade. Switching to another TTY and back resolves it.
I can also confirm that changing negative output positions to positive fixed the issue for me.
to
Also, only xwayland applications were affected from what I can tell (Discord, slack, skype, quasselclient)
Came here with the same issue where I couldn’t click on a window when it was placed on a secondary display. I had negative coordinate positions in my output configuration.
I replaced it with the code below, the window works fine now!
I’m going to guess something doesn’t deal well with negative offsets. If it matters, I only found the issue in vscode which I believe still runs XWayland.
Can replicate this with swaylock and closing the lid of my laptop while Firefox is open. I have an AMD Ryzen 7 4750U if that matters (saw it mentioned earlier in the thread). Can be worked around by switching to another TTY and then back.
I am not using swaylock or nvidia
The following may help for those who are having the VirtualBox cursor/pointer grab issue (where you can move the mouse on the host but clicking doesn’t have any effect until you quit the VM). Since this issue is mentioned here, I thought I’d post what works for me. This was on a regular Xorg session, but hopefully it helps on Wayland as well.
Workaround: force an ungrab, so you don’t have to close VirtualBox to get mouse clicks to work again.
do you use negative screen coordinates? that was the reason for me
https://github.com/swaywm/sway/wiki#mouse-events-clicking-scrolling-arent-working-on-some-of-my-workspaces
On 04.03.2020 20:26, Denis wrote:
I’ve to add that this issue is not VirtualBox related. I’ve this issue on my arch installation as well.
New to sway, so if someone can guide me to be of any help in this issue?
Hi - I have been seeing this issue for a few months. Recently it’s started getting more frequent.
I use sway on Arch. Firefox and wezterm are >90% of the use. Dual monitors, side-by-side. Laptop sits on the left. Desktop on the right. I regularly switch the left monitor between extending my macOS laptop to extending the Linux desktop screen. (I have a script that uses
wl-randrandddcutilto switch things around). I use waynergy on Sway and Barrier on macOS to share mouse and keyboard.As reported above in this thread, occasionally my mouse would not allow me to click and focus-follows-mouse would stop working. Keyboard had no issue and I can navigate around using keyboard shortcuts.
I could never figure out why this was happening, or how to reset or regrab the mouse so it would start working again. I’ve tried killing Xwayland, debugging waynergy etc. Only a new sway session or reboot would fix.
However - I now realise - as of about 30minutes ago that when I
killall firefox, I get the mouse control back and all is working as normal.Until it happens again a few minutes later. then I kill firefox and - as if by magic - it all works again. For a few minutes.
So - is there any troubleshooting I can do to help? I seem to be able to reproduce this easily.
EDIT - Oh no… As I was typing this comment, the issue occurred without firefox being open. Back to square one. I’ll leave this comment in case it’s useful.
I noticed that with all windows closed, I can’t click on waybar, but if I pop up swaynag, then I just need to click above waybar (on the swaynag toolbar) and clicks are registered on the waybar. Meaning clicks are offset on the Y-axis. Not sure if it’s a symptom or a cause of the issue.
It doesn’t work for me usually anymore either 😦.
I’m not using the local mouse and keyboard when this happens (waynergy) and having tried that solution several times it doesn’t appear to work for me.
I just wish that any kind of debug logging would give evidence of what happens, as thus far no one’s attempts in this thread with debug logging of sway, libinput, or even generic wayland debug logging have revealed messages specific to this problem.
I have tried the suggestion from bughunter, which did not work, but I have not tried TTY-switching. I’ll try that next time.
I also have these issues, but not using Waynergy. Just as described above, changing temporarily to another TTY and back, brings back the ability to click and scroll correct window (focus follows mouse) using the cursor.
Moving the cursor works all the time.
Did you try this?
Thanks for the workaround !
I can also confirm that apparently it was the use of a negative position for the external display that was preventing the mouse from working in the external display for me. Putting the primary display at 10000,10000 was sufficient to made all position coordinates be positive.
Hello everybody.
I am new to Sway and Wayland and I am hitting this issue too.
Weird is that for me mouse can be stuck with previously focused application. And when I have horizontal split screen - moving mouse over affected window (chromium) didn’t work, but when I moved my cursor over the other window, scrolling was affecting the other window.
Software
Configuration
Is default plus small additions
Not sure how to check if I am using negative coordinates or not, but I know have ultra-wide screen … if it is relevant at all or not, dunno.
Note: I still need to run
sudo libinput debug-events👼I also experience this, using a model 01. When it happens I just bounce to another tty and sway gets unstuck.
I replicate this all the time when debugging X applications, if say a game hits a breakpoint while having captured mouse focus, other X applications won’t receive mouse input at all. This should be a issue in wlroots as mentioned, though. I think this is a critical bug and could even require someone to restart sway and close all their programs if the causing application won’t respond to a SIGTERM. It very often requires me to use my (thankfully) native wayland terminal to SIGKILL the guilty process.
I managed to fix the problem by replugging my keyboard. This has worked 2 out of the 2 times I attempted it. I have attached the inputs and outputs captured while the bug was not active. I do not have a debug log.
The keyboard I was actively using and that I replugged is
Keyboardio_Model_01. This keyboard can also act as a mouse. This seems relevant now so I apologize for not writing about that detail earlier. I do not actively use its mouse function but I might invoke it by accident.There is another keyboard connected which I was not touching and conventional mouse. When I was referring to the mouse not working I meant this mouse.
It seems possible that this is a bug with having two mice connected at the same time. It could also be that it is a bug on the keyboard/mouse hybrid side. I have tried pressing all the buttons that invoke mouse actions on the keyboard but could not reproduce the problem. I have not tried using the keyboard mouse when the other mouse is in the bugged state.
With this we have 3 different potentially unrelated descriptions (Virtualbox, replugging monitor, replugging keyboard/mouse) for this bug.
get_inputs.txt get_outputs.txt
I have noticed this, or something similar, happening occasionally when I’m using Virtualbox with both its gui and the guest os’ gui open. Clicks don’t register on any xwayland (keyboard is fine) app until I quit virtualbox. Clicks DO register on some (not all) native wayland apps though. Happens once in a blue moon and have yet been unable to capture in a debug-on sway session. Normal debug just says a line or two on some error in xcb.