Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

share|improve this question
3  
One might note that this is actually the very meaning of "printing your screen"... ;-) –  Chris Down Apr 30 '13 at 6:51
    
This sounds like something that your DE, Gnome or KDE, would handle... –  jasonwryan Apr 30 '13 at 6: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. –  mellowmaroon May 1 '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. –  mellowmaroon May 1 '13 at 19:27

2 Answers 2

up vote 3 down vote accepted

You should be able to disable PrntScr on the console with a custom keymap. I'm using Archlinux and the procedure is described here: Configuring the Console Keymap (it should be similar for other distros). Now, at step 4, edit your personal.map:
Switch to a tty, run showkey and press PrntScr to get the key code. On my system the output is:

keycode 99 press
keycode 99 release

so PrntScr code is 99.

Add

keycode  99 = nul

to personal.map, gzip the file and copy it under /usr/share/kbd/keymaps/i386/qwerty/.
Switch again to tty and run loadkeys personal to load the custom keymap then hit PrntScr to test the new keymap. Edit /etc/vconsole.conf to make it permanent.

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). Key code is <PRSC>, just comment it out (add // in front of it).

e.g.
on my system, X uses the following keycodes file: /usr/share/X11/xkb/keycodes/evdev
Replacing

<PRSC> = 107;

with

// <PRSC> = 107;

completely disables PrntScr.

share|improve this answer
    
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! –  mellowmaroon May 2 '13 at 6:06

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

share|improve this answer

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.