Alt+Printscreen stopped working, how to find processes listening to events

Very odd issue today. I was going to post a thread about another issue and wanted to take a screenshot of a terminal window. I got it all prepped, hit Alt+Printscreen and nothing happened.

I went into Keyboard Shortcuts to see if redefining the shortcut worked. It did. I tried to set it back to Alt+Printscreen but the window just sat there listening for a keypress. It's as if I never pushed a key.

Both the Alt and Printscreen keys work independently just fine... I've also tried looking at the output of xev as I press the keys. It hears the Alt press but doesn't hear the Printscreen afterwards.

I've tried this from both within Compiz and plain metacity. I also have a spare keyboard and that shows identical behaviour (one keyboard is PS/2, the spare is USB - so not a port issue).

It's like there's something sitting in the event chain spitting on the event so that nothing else can hear it. My question is basically: how can you find the processes responding to certain events?

As requested:

oli@bert:~$ xmodmap -pke | grep -i mode
keycode  82 = KP_Subtract XF86_Prev_VMode KP_Subtract XF86_Prev_VMode
keycode  86 = KP_Add XF86_Next_VMode KP_Add XF86_Next_VMode
keycode 100 = Henkan_Mode NoSymbol Henkan_Mode
keycode 203 = Mode_switch NoSymbol Mode_switch

And

oli@bert:~$ xmodmap -pke | grep -i print
keycode 107 = Print Sys_Req Print Sys_Req
keycode 218 = Print NoSymbol Print

Edit: When I posted this I was on Lucid with a home-built 2.6.35 kernel. It turns out my issue is related to the kernel and not X.

Somebody somewhere has decided that alt-printscreen should render a SysRq event. Technically speaking, perhaps it should but this breaks what-must-be over a decade of Linux and Windows "known behaviour".


Per my edit, this appears to be directly linked to the kernel version 2.6.35 (and probably subsequent kernels) whereby alt+prscr renders a sysrq event.

SysRq appears to be unbindable (at least from my messing around) but you can disable the silly new behaviour by adding the following to /etc/sysctl.conf:

kernel.sysrq = 0

Since you indicate PrintScreen works but alt+printscreen doesn't, it could be something to do with your modifier mapping.

If you have 2 Alt keys, can you try with both and see if behaviour is same ?

Also, can u run the command xmodmap -pke | grep -i mode in a terminal and check if that indicates one of the alt keys is mapped as "Mode switch" key ? Typically you would see 1 or more keysym lines containing codes assigned to the Mode switch key.

Also run xmodmap -pke | grep -i print in a terminal and see if the codes printed to the right of the equal sign match with the below line.

keycode 107 = Print Sys_Req Print Sys_Req

See this page for explanation of the syntax of the keysym line.


Reported bug is there. https://bugs.launchpad.net/ubuntu/+source/metacity/+bug/642792