How to change PrtSc key to Menu in Ubuntu 17.10?
I have Lenovo Thinkpad Yoga 14 which has PrtSc key on the keyboard. I personally find this key totally useless as I prefer using Screenshot application to select the required area and take a snapshot. I am trying to change its functionality to the Menu key, which can be used to access context menus similarly to right clicking. But I am not able to find this setting. How to do it?
Xmodmap
is deprecated for recent Ubuntu versions and because it does not persist when rebooting/suspending/changing tty, it is better to hack the X keyboard extension, or xkb
.
To do so:
First, make a backup copy of your original file
/usr/share/X11/xkb/keycodes/evdev
-
Edit the file and set
alias <MENU> = <PRSC>;
instead of what was defined before. It will assign the keycode assigned to
<PRSC>
to<MENU>
. Reboot, or restart Xorg.
Hence under X.Org server, your PrSc key becomes a Menu Key and it does persist in any case.
As Roman Zotov shared, there is truly no need to reapply the whole keyboard mapping. Thanks for that! Just use the first two steps to find correct keycode and apply the change for one key only.
I had the same problem with my T480 with Linux Mint 19 but I managed to fix it using these steps from Fedora forum:
-
Save the current keyboard map to a new file
xmodmap -pke > ~/.xmodmap
-
In the file find
keycode 107 = Print Sys_Req Print Sys_Req
change it to
keycode 107 = Menu NoSymbol Menu
and save it.
-
Load the modified keymap
xmodmap ~/.xmodmap
Now it should work (it does for me) but reboot makes it into default settings.
To fix that, I added the command from step 3. as a start-up command. All works great now.
Source: https://forums.fedoraforum.org/showthread.php?300542-ThinkPad-X240-Remap-PrtSc-key-to-Right-Click-Menu-Context-Menu