Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

What command line tools exist to list and manage X server grabs? (That's grab as in key and pointer grabs, i.e. restricting the use of a particular key or mouse button to a particular application, or constricting the mouse pointer to remain in a particular screen area.) I'm looking for a hypothetical xgrab utility that would show things like

Key     0x00f00ba5  0x123   0
Button  0x00f00ba5  2       
Pointer 0x00abcdef  

meaning that there has been a call to XGrabKey(display, 0x123, 0, 0x00f00ba5, ...) and so on with XGrabButton, XGrabPointer, XGrabKeyboard, XGrabServer (if possible). The display format doesn't matter, what I want is some way to see who's grabbing what, and possibly some way of revoking these grabs (if it's possible, I'm not sure if the X11 API allows that).

share|improve this question

2 Answers 2

up vote 4 down vote accepted

Recent versions of X (X.org server ≥1.11) support several debugging keysyms, introduced in this commit. When triggered, these perform actions related to grabs.

By default (at least in recent versions), these are disabled (absent from the default keymap).

However, if you have xdotool installed, it is possible to call them, by executing on the command-line:

xdotool key NameOfKey

where NameOfKey is the keysym you want to activate. For example, to print a list of active grabs to the X server log, use xdotool key XF86LogGrabInfo.

Relevant keysyms are:

share|improve this answer

I don't know of anything off hand for the passive grabs1 of a single key or button that may be present, but there are a couple ways to list active grabs of an entire keyboard or mouse device.

  1. On all platforms, but only with Xorg 1.11 and later (or an older version with the patch applied), map hotkeys to dump grab data to the log as described in these patch notes.
  2. On Solaris 11 (either Solaris 11 Express 2010.11 or the actual Solaris 11 release), use the debugger scripts such as /usr/demo/Xserver/mdb/list_Xserver_devicegrab_client, as described in Grabbing Information from the X Server. There's also one here for server grabs, which the Xorg 1.11 hotkeys don't currently cover.

1 See http://tronche.com/gui/x/xlib/input/pointer-grabbing.html for definition of active vs. passive grabs.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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