I am on Ubuntu and using a Microsoft keyboard. I want to map my Win key to a Ctrl key. How can I do that?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
xmodmap lets you modify keymaps. Make a file to hold xmodmap commands (~/.xmodmaprc is a common choice). The Win keys are called “Super” in xmodmap (Super_L and Super_R for the left and right ones). By default they’re connected to mod4, so you want to remove them from that modifier and add them to control. Add this to the command file:
remove mod4 = Super_L Super_R add control = Super_L Super_R
Tell xmodmap to load it with:
$ xmodmap ~/.xmodmaprc
It will only last as long as your X session does, so you’ll need to rerun it each time, or put it in something like ~/.xinitrc so it will be run automatically
Method 2
jinx:819 Z$ grep ctrl /usr/share/X11/xkb/rules/evdev.lst | grep win altwin:ctrl_win Control is mapped to Win keys (and the usual Ctrl keys) altwin:ctrl_alt_win Control is mapped to Alt keys, Alt is mapped to Win keys
Go into the keyboard settings, click “Options”, expand “Alt/Win key behavior”, and select “Control is mapped to Win keys”.
(Command line version: setxkbmap -options altwin:ctrl_win, then edit /etc/X11/xorg.conf and add XkbOptions "altwin:ctrl_win" to the keyboard InputDevice section. (If there is already an XkbOptions line, then add it to that line, separated by a comma: XkbOptions "grp:alt_shift_toggle,altwin:ctrl_win".)
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0