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

7,834

Solution 1

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

Solution 2

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:
7,834

Related videos on Youtube

Oli
Author by

Oli

Hi, I'm Oli and I'm a "full-stack" web-dev-op. Eurgh. I'm also allergic to jargon BS. I spend most of my professional time writing Django websites and webapps for SMEs. I write a lot of Python outside of Django sites too. I administer various Linux servers for various tasks. I contribute to the open source projects that I use when I can. I'm a full-time Linux user and that has lead to helping other people live the dream. I am an official Ubuntu Member and I earnt my ♦ on SE's own Ask Ubuntu in 2011's moderator election. That's probably where I spend most of my unpaid time. I also run thepcspy.com which has been my place to write for the last decade or so. If you need to contact me for extended help, you can do so via my website, just remember that I have bills so if I feel your request is above and beyond normal duty, I might ask for remuneration for one-on-one support. For more social contact, you can usually find me (or just my computer) lurking in the Ask Ubuntu General Chat Room and on Freenode in #ubuntu and #ubuntu-uk under the handle Oli or Oli``.

Updated on September 17, 2022

Comments

  • Oli
    Oli over 1 year

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

    • Admin
      Admin over 13 years
      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.
    • Admin
      Admin over 13 years
      Do you have any other programs running that would be intercepting the alt key?
    • Admin
      Admin over 13 years
      I didn't have an issue with this on my laptop running 10.04 - What version are you running?
    • Admin
      Admin over 13 years
      @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.
  • Michael Gundlach
    Michael Gundlach over 13 years
    Alt + PrintScreen grabs current window.
  • Oli
    Oli over 13 years
    Yes, the key works fine. Normal printscreen window pops up. Alt+PS should take the windowshot but doesn't.
  • Oli
    Oli over 13 years
    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.
  • koushik
    koushik over 13 years
    You're right. Mod maps look fine. Strange as it sounds, someone is eating Alt+Prnt Scrn ...
  • Admin
    Admin over 13 years
    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."
  • Oli
    Oli over 13 years
    @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.
  • Admin
    Admin over 13 years
    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.
  • MestreLion
    MestreLion over 12 years
    Alt + PrintScreen exists since the dawn of time, maco ;) I remember using it in Windows 98
  • MestreLion
    MestreLion over 12 years
    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?