Sometimes Firefox doesn't release the mouse after dragging, so I need to kill the application to force it to release its pointer grab.
Is there any command to force an application to ungrab the pointer without killing it?
Sometimes Firefox doesn't release the mouse after dragging, so I need to kill the application to force it to release its pointer grab.
Is there any command to force an application to ungrab the pointer without killing it?
On modern-ish X.org installations, there is an XF86Ungrab
keysym, which causes the server to release all active pointer or keyboard grabs. You can make the server break all grabs by enabling break action XKB option, then generating the keysym either with a command or with the keyboard. With xdotool:
setxkbmap -option grab:break_actions
xdotool key XF86Ungrab
On some systems, the XF86Ungrab
keysym is bound to the key combination Ctrl+Alt+Keypad /. However this possibility is often turned off because it could allow bypassing a screensaver).
I answered this on Super User, and am quoting it here:
[As Gilles noted,] In fact, it is possible to do this (at least with recent versions of X).
You can do this by pressing the XF86Ungrab key, introduced in this commit.
By default, this keysym is not bound to any physical key or key combination (it was disabled in 2012 after it was reported as a security hole, since it allows anyone to bypass lock screens by breaking their grabs). On some other setups it is bound to a shortcut that uses the number pad. Obviously, that won't work on laptops that lack a keypad.
But you can still activate the keysym using
xdotool
:xdotool key XF86Ungrab
This works with X.org version 2:1.11.4-0ubuntu10.8 on Ubuntu Precise.
This may be like killing a fly with a hammer, but my desperate solution was to just use htop to locate and kill the program that locked up my mouse pointer. Sorry, after writing this, I noticed your question explicitly says "without killing it".
Background:
I had the same issue happen to me in File-Roller. I tried to extract a file within an archive by dragging it to PCManFM in Awesome Window Manager. My mouse pointer changed to a grab-pointer-icon, and I couldn't click on anything. It was so frustrating.
Steps to Kill Process:
super+enter
in Awesome, but are typically ctrl+alt+t
in most desktop environments.This may not be the best way to do it, but it worked for me and it is easy to remember in a pinch.
Ctrl+G
for their own purposes, there is no such X-wide binding.
– Gilles 'SO- stop being evil'
Jun 11 '12 at 00:49