1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[linux] CapsLockとCtrlを入れ替える

Last updated at Posted at 2020-04-19

開発環境

Linux
Ubuntu
bionic
xfce

方法

  1. localectl
  2. Xmodmap (非推奨)

localectl

実はxmodmapは使わないやり方があった!
その名もlocalectl!!!!!!!!!
こいつで勝つる!

US配列キーボードの設定例
localectl --no-convert set-x11-keymap us pc105 "" ctrl:swapcaps   
設定内容を確認
localectl status
System Locale: LANG=ja_JP.UTF-8
   VC Keymap: n/a
  X11 Layout: us
   X11 Model: pc105
X11 Options: ctrl:swapcaps

設定(config)ファイルの場所

  • /etc/default/keyboard
  • /etc/default/locale

直接編集して変更することも可能。

Xmodmap (このやり方は古い!おじいさんの古時計並に)

  1. 変更対象のCapslockとcontrolのキーコードをしらべる
  2. ~/.Xmodmapに2行記述する。
  3. ~/.Xmodmapを再読込する。

キーコードを調べる

xev

自分のキーコードは

  • Caps_Lock が 66
  • Control_L が 37

でしたので、これを入れ替えるだけです。

  • Caps_Lock を 37 に変更
  • Control_L を 66 に変更

~/.Xmodmapに記述

設定例
keycode 37 = Caps_Lock
keycode 66 = Control_L

~/.Xmodmapを再読込

xmodmap ~/.Xmodmap   
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?