[LINUX] Use the xmodmap command to operate the Caps Lock key as the Ctrl key.

What about this article?

--Describes how to use the Caps Lock key as the Ctrl key with the xmodmap command. -= Replace the Caps Lock key with the Ctrl key. --Cinnamon or GNOME3 can be realized with standard functions, but it seems that Xfce cannot. ――Please let me know if you know. --Operation check environment - Fedora 31 64bit

TL/DR; --Install Xodmap. --It should be old software, so it should be most X Window environment. --Test by writing key bindings in ~ / .Xmodmap. --Set to write in .bashrc and read automatically at login.

procedure.

Install xmodmap.

sudo dnf install xmodmap

--With yum up to CentOS7. (Which of fedora is fine, but when yum can't be used ...)

sudo yum install xmodmap

Test by writing key bindings in ~ / .Xmodmap.

Keymap settings. (The file name can be anything.)

cat << '_EOT_' >> ~/.Xmodmap 
clear lock
keycode 66 = Control_L
add control = Control_L Control_R
_EOT_

--On my laptop, Capslock's keycode was 66. --Check around xev. - dnf install xev --Tap xev to find out the keycode. --After hitting xev on the terminal, if you press the corresponding key while the xev screen is active, you can check the key code as shown below. --As shown in the capture below, the keycode for Capslock is 66. image.png

Keymap setting read test.

xmodmap ~/.Xmodmap
echo $?

Set to automatically load keymap settings when logging in.

cat << '_EOT_' >> ~/.bashrc 
xmodmap ~/.Xmodmap
_EOT_

Check if there is moss by reading .bashrc.

source ~/.bashrc 
echo $?

Digression

--Since the Alt key does not respond on my laptop, the conversion key, non-conversion key, and katakana / hiragana key are all operated as Alt keys as shown below.

cat ~/.Xmodmap
clear lock
clear mod1
keycode 100 = Alt_R
keycode 101 = Alt_R
keycode 102 = Alt_R
keycode 66 = Control_L
add mod1 = Alt_R
add control = Control_L Control_R

――At first, I used to use Windows-like cinnnamon, but over time the machine specs couldn't keep up. --LXDE is also comfortable, but there is a bug that forces the US keyboard to be recognized. --Xfce comfortable. ――I feel that some of the shortcuts are unique ...

reference

https://wiki.archlinux.jp/index.php/Xmodmap

Recommended Posts

Use the xmodmap command to operate the Caps Lock key as the Ctrl key.
[Linux] How to use the echo command
How to use the Linux grep command
3 best ways to use the less command
Linux user addition, how to use the useradd command
How to use the grep command and frequent samples
Specify MinGW as the compiler to use with Python
(Remember quickly) How to use the LINUX command line
How to use the generator
How to use the decorator
Use DynamoDB as a lock manager
How to use the zip function
[linux] Swap Caps Lock and Ctrl
In the python command python points to python3.8
How to use MBDyn (command setting)
[linux] kill command to kill the process
How to use the ConfigParser module