8

I recently came across a Linux feature I have never seen before, where pressing the PrntScr button on the keyboard prints a physical piece of paper with the contents of my console.

I really need to find out how to disable this. It is driving me crazy.

I followed a guide on creating a custom keymap, and I tried remapping it to Esc and loading my custom keymap instead, but it didn't seem to work. By disabling, I mean I would preferably like the key to not send any input at all, and ideally I would like to allow CUPS to continue running.

What exactly controls this behavior? And are there any specific man pages I can read about this?

EDIT: A little bit of additional info I should have given: I launch Openbox after logging into a TTY rather than using a DM. I am looking for a solution that would disable printing even if I were on a TTY, since PrntScr prints from a TTY as well.

don_crissti
  • 82,805
  • 3
    One might note that this is actually the very meaning of "printing your screen"... ;-) – Chris Down Apr 30 '13 at 06:51
  • This sounds like something that your DE, Gnome or KDE, would handle... – jasonwryan Apr 30 '13 at 06:54
  • @ChrisDown Yes, it was obvious to me afterward what had caused a page to print haha. On my laptop, this is a bigger problem because the PrntScr key is near Backspace and a very slim Delete. –  May 01 '13 at 19:24
  • @jasonwryan I posted info about my graphical environment (no DE to speak of). I am aware of keybinding abilities with Openbox, but since it will print while I am in a TTY as well, I would like to just disable the key itself, or change whatever handles this in the system. –  May 01 '13 at 19:27

2 Answers2

3

You should be able to disable PrntScr on the console with a custom keymap. On archlinux the procedure is as follows (it should be similar for other distros):

  1. cd /usr/share/kbd/keymaps/i386/qwerty
  2. copy your default keymap to a new file: cp us.map.gz personal.map.gz
  3. gunzip the new map file: gunzip personal.map.gz
  4. edit personal.map using your favorite editor:
    switch to a tty, run showkey and press PrntScr to get the key code. On my system it outputs:

    keycode 99 press
    keycode 99 release
    

    so PrntScr code is 99. Add

    keycode  99 = nul
    

    to personal.map

  5. gzip the map file: gzip personal.map then run loadkeys personal to load the custom keymap then hit PrntScr to test the new keymap.
  6. make it permanent by (creating if not present and) editing /etc/vconsole.conf: replace KEYMAP=us with KEYMAP=personal.
  7. reboot

The above works only on console, you will have to disable PrntScr also in X.
One way to do that is to comment it out in your X keycodes file (the one corresponding to your keyboard - linux uses /usr/share/X11/xkb/keycodes/evdev). Key code is <PRSC>, just comment it out (add // in front of it) e.g. replacing

<PRSC> = 107;

with

// <PRSC> = 107;

completely disables PrntScr.

don_crissti
  • 82,805
  • I didn't know I had to remap keys for X as well! The console half seemed to work when I did it anyway. I will assume it works, accept it, and test it when I have a little more time. One question though: where did you find the info about X keymaps? Thanks a ton! –  May 02 '13 at 06:06
1

If you're using GNOME I believe you can do this through gconf-editor.

$ gconf-editor

Then navigate the left side hierarchy like so:

/apps/metacity/global_keybindings

You'l l want to set the attribute "run_command_screenshot" to "disabled".

screenshot

    ss of gconf-editor

slm
  • 369,824