1

I want to make caps lock as control key, so I wrote this setxkbmap -option caps:ctrl_modifier to my bashrc file. The problem is that after I log in the next time or restart the system, nothing happened. Caps lock is still caps lock... So how to change caps lock to control key?

Daniel
  • 11
  • 2
  • `~/.bashrc` commands just affects terminal session. You could assign this command to `~/.profile`or create a script with this command and add it to your [session startup programs](https://askubuntu.com/questions/48321/how-do-i-start-applications-automatically-on-login) – Redbob Sep 27 '17 at 03:08

3 Answers3

1

To make that change system wide and persistent, open /etc/default/keyboard for editing, change the line

XKBOPTIONS=""

to

XKBOPTIONS="caps:ctrl_modifier"

and reboot.

Gunnar Hjalmarsson
  • 32,938
  • 3
  • 63
  • 94
0

~/.bashrcscript just change defaults at terminal session, and it doesn't extend to other areas of your environment. To make this, you could create a script file with this command in it, as:

#!/bin/sh
/usr/bin/setxkbmap -option caps:ctrl_modifier

Then you add it to your sesssion startup manager, as you can see here

Redbob
  • 1,543
  • 1
  • 11
  • 23
0

I assigned the command to ~/.profile and it works. Now I see that ~/.bashrc script just change defaults at terminal session, people who are fresh to linux like me should notice this too. Thank you guys!

Daniel
  • 11
  • 2