In Linux, map the Caps_Lock key to Ctrl

Source: Internet
Author: User

I used Debian 7, which used to be a gnome Desktop. The system has settings for changing the keyboard layout. Before gnome collapsed once, it was replaced with openbox, and it can be used very well with a little configuration.

See this article 5-minute OpenBox Configuration Guide.

However, I did not find the keyboard layout modification in the system, so I searched for articles related to ctrl and caps lock on the Internet.

The content of the. xmodmap file is as follows:

Remove Lock = Caps_Lock
Remove Control = Control_L
Keysym Control_L = Caps_Lock
Keysym Caps_Lock = Control_L
Add Lock = Caps_Lock
Add Control = Control_L

Switch the left ctrl and caps lock. during use, I found that the usage of the caps lock is extremely low. In this way, it is easy to accidentally press the left ctrl button after the swap, resulting in incorrect case switching.

So I tried to change it.

Remove Lock = Caps_Lock
Remove Control = Control_R
Keysym Control_R = Caps_Lock
Keysym Caps_Lock = Control_R
Add Lock = Caps_Lock
Add Control = Control_R

In this way, both caps lock and ctrl are ctrl functions. Run

Xmodmap ~ /. Xmodmap 2>/dev/null

Run xmodmap and you can see that it has not changed before modification.

Shift Shift_L (0x32), Shift_R (0x3e)
Lock & nbsp; Caps_Lock (0x42)
Control Control_L (0x25), Control_R (0x69)
Mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)
Mod2 Num_Lock (0x4d)
Mod3
Mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
Mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)

You can run the command every time you start the system, or write the. bashrc or other configuration files

I used openbox desktop, which has an autostart file, which I wrote

#
# These things are run when an Openbox X Session is started.
# You may place a similar script in $ HOME/. config/openbox/autostart
# To run user-specific things.
#

# If you want to use GNOME config tools...
#
# If test-x/usr/lib/openbox/gnome-settings-daemon>/dev/null; then
#/Usr/lib/openbox/gnome-settings-daemon &
# Elif which gnome-settings-daemon>/dev/null; then
# Gnome-settings-daemon &
# Fi

# If you want to use XFCE config tools...
#
# Xfce-mcs-manager &
Tint2 &
Xmodmap ~ /. Xmodmap 2>/dev/null

Recommended reading:

Map the Caps keyboard to Esc in Linux

Debian 7.0 Wheezy test experience

Debian 7.0 Wheezy released!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.