7

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

Kris Harper
  • 13,477
Oli
  • 293,335
  • I had a similar issue where I wasn't able to use two key sequences on my keyboard. The first was solved by looking at my Keyboard Layout Options and finding that that key was being used to do something like change the keyboard layout. The other was fixed when I found that two of the three keys in the key sequence were a shortcut in themselves. – Umang Aug 27 '10 at 13:48
  • Do you have any other programs running that would be intercepting the alt key? – TJ L Aug 27 '10 at 13:49
  • I didn't have an issue with this on my laptop running 10.04 - What version are you running? – Marco Ceppi Aug 27 '10 at 14:29
  • @Marco: 10.04. I don't believe it's a bug so much as it's something else interfering with the event stack. @tj111: Not that I know of but that's part of the problem. I'd like to know what's listening to global keyboard events. – Oli Aug 27 '10 at 15:33

4 Answers4

5

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
Oli
  • 293,335
  • SysRq is unbindable because that's why it was created: "Introduced by IBM with the PC/AT, it was intended to be available as a special key to directly invoke low-level operating system functions with no possibility of conflicting with any existing software." –  Oct 07 '10 at 16:52
  • @Roger: Perhaps that's the case but for as long as I've been using Linux, the kernel has let it trickle through to be bindable as alt+printscreen. Stopping that behaviour after such a long time is a bug in itself. – Oli Oct 07 '10 at 22:01
  • I'm not saying you're wrong, just explaining why sysrq works the way it does. You might try winkey/super bindings; I use it for almost all of my window manager shortcuts. –  Oct 07 '10 at 23:45
  • 1
    This is weird: I had the same issue, but before changing anything I tried to see what my current setting was: sudo sysctl -a | kernel.sysrq shows... kernel.sysrq=0 !!! But the fix was still needed: sudo sysctl -w kernel.sysrq=0 and the problem was gone! Pretty confusing, huh? – MestreLion Nov 24 '11 at 05:17
  • Mmm... I'm sure that right now the Alt + PrtSc works as intended. The only way to activate sysrq is using Ctrl + Alt + Shift. – Braiam Dec 09 '13 at 14:11
1

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

1

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.

koushik
  • 5,072
  • Edited my post. Looks like these mappings are present and correct. AltGr is not the same as Alt. AFAIK AltGr+PrtSc shouldn't show a printscreen window but if it should, it's not here. – Oli Aug 27 '10 at 22:23
  • You're right. Mod maps look fine. Strange as it sounds, someone is eating Alt+Prnt Scrn ... – koushik Aug 28 '10 at 01:39
0

Did you try just using Print Screen? I've never heard of using Alt with it.

maco
  • 15,892