Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question
    
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? –  tj111 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 Answers 4

up vote 5 down vote accepted

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
share|improve this answer
    
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." –  Roger Pate Oct 7 '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 7 '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. –  Roger Pate Oct 7 '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 5: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 9 '13 at 14:11

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.

share|improve this answer
    
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 1:39

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

share|improve this answer
    
+1 for filling such a detailed report (including the correct kernel workaround) –  MestreLion Nov 24 '11 at 5:11

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

share|improve this answer
3  
Alt + PrintScreen grabs current window. –  Marco Ceppi Aug 27 '10 at 14:30
    
Yes, the key works fine. Normal printscreen window pops up. Alt+PS should take the windowshot but doesn't. –  Oli Aug 27 '10 at 15:31
    
Alt + PrintScreen exists since the dawn of time, maco ;) I remember using it in Windows 98 –  MestreLion Nov 24 '11 at 5:10
    
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. –  Peachy Sep 8 '12 at 4:26

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.