Remapping Print Screen to Context Menu in Ubuntu using xmodmap

Filed under: TechNotes, Linux — lars @ 03:14:00 am

My new laptop is missing the Context Menu key, which I use quite a lot, and in it's place is the Print Screen key, which I use rarely.  I wanted to find a way to re-map Print Screen to Context Menu.  It turns out, in my case, this is possible in Ubuntu by just adding the following command to my list of "Startup Applications" in gnome:

/usr/bin/xmodmap -e "keycode 107 = Menu"

In the above, 107 is the key code for Print Screen, and Menu is the new operation that I am mapping it to.

To make this work correctly, I also had to go to Gnome's Settings -> Keyboard -> Shortcuts -> Screenshots, and disable the mapping using the Print Screen key by itself.

In order that I could still take screenshots of windows or screen areas just the same as before, I also used Gnome's keyboard shortcuts settings to re-mapp the shortcuts for Alt-PrintScreen and Shift-PrintScreen to Alt-Menu and Shift-Menu.

If you would like to remap other keys, here is a list of all the key symbols recognised by xmodmap.  The below command is also useful, which will dump out all your existing (default) mappings to a file:

xmodmap -pke > ~/.Xmodmap

Comments

  • spaceapple
    This worked perfectly on my own laptop under opensuse 13.1.
    Thanks a lot for this.

    Comment by spaceapple [Visitor] — 03/22/14 @ 03:12

Leave a comment

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>


Options:
(Line breaks become <br />)
(Set cookies for name, email & url)




powered by  b2evolution