Keyboard Shortcuts – Alt+Printscreen Stopped Working, How to Find Processes Listening to Events

eventskeyboardshortcut-keys

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

Best Answer

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
Related Question