Linux: Setup Shift Lock Key

By Xah Lee. Date: . Last updated: .

This page shows you how to setup the Shift or CapsLock keys do shift-lock.

what is Shift-lock

Shift-lock means you don't have to hold the Shift key. For example, to enter T, press the Shift key, release, then press t.

How to Make CapsLock Do Shift-Lock

To make CapsLock do shift-lock, run this in terminal:

# linux, set capslock as shift lock
setxkbmap -option caps:shiftlock

How to Make Shift Do Shift-Lock

Create a file at ~/.Xmodmap. The file content should be this:

! -*- coding: utf-8 -*-
! 2017-01-14

! make capslock and shift keys do shift lock

! here's the default setting on special keys
! xmodmap -pke | grep -iP '(shift|caps)'
! keycode  50 = Shift_L NoSymbol Shift_L
! keycode  62 = Shift_R NoSymbol Shift_R
! keycode  66 = Caps_Lock NoSymbol Caps_Lock
! keycode  92 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift

! make capslock do shift lock
xmodmap -e "keycode 66 = Shift_Lock"

! make the left Shift key do shift lock
xmodmap -e "keycode 50 = Shift_Lock"

! make the right Shift key do shift lock
xmodmap -e "keycode 62 = Shift_Lock"

Now, run this line in terminal:

xmodmap ~/.Xmodmap

That's it.

When X11 starts, that file will be loaded automatically.

See also: Ban Shift Key