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?

  • 2
    If you have the command line you can try to disable and re-enable the mouse. See this wiki page. I'm not sure it works, especially if the reason for the freeze is related to a Javascript issue.
    – Paolo
    Jun 10 '12 at 21:09
  • @Guandalino: I have command line (By opening another terminal by pressing Alt+F2); I will test this in the next occurrence of the problem, Thanks
    – Ariyan
    Jun 10 '12 at 21:13
  • 2
  • I started having this problem with Firefox 13, and a web search brought me to this question. Are you by any chance using the Tree Style Tabs extension? It seems to be some problem with dragging tabs.
    – Juliano
    Jun 12 '12 at 22:53
  • @Juliano: I didn't used Tree Style tabs ext. ! And Up now I didn't seen problem again so I didn't tried solutions too.
    – Ariyan
    Jun 19 '12 at 6:35

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).

  • Do I have to run the above command every time, or at every boot, or just once? Aug 14 '18 at 17:17
  • @AaronFranke Run this command when the problem occurs. Aug 14 '18 at 19:04

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.


Ctrl + G will release mouse focus in most situations.

  • Sorry I'd like to understand better, is this a linux specific thing or firefox?
    – Paolo
    Jun 10 '12 at 22:23
  • Linux, not completely sure, but i think it is a xorg function. I use it often to release focus from fullscreen videogames.
    – llua
    Jun 10 '12 at 22:36
  • 2
    I doubt that this work; it is a single modifier plus a key, these combinations are used for applications (e.g. firefox activates "Find" box with this) and not for something like X (X uses keys like Alt+Ctrl+Backspace)! after that I tried it in a normal drag and drop and nothing happened!
    – Ariyan
    Jun 11 '12 at 0:48
  • 4
    That is not the case in any version of Firefox that I've seen, and it is definitely not the case “in most situations”: many applications use Ctrl+G for their own purposes, there is no such X-wide binding. Jun 11 '12 at 0:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.