I have two commands that change keyboard behaviour:
xset r rate 120 66
/usr/bin/setxkbmap -option "ctrl:nocaps"
When I open a terminal and execute them, they change auto-repeat settings and remap CAPS LOCK to control, not only in the terminal window but for my whole desktop environment.
I'd like them to be run automatically when I login to my account (either using a GUI or via ssh/etc.). I'd like to do this in a robust way (i.e. I don't want to use distribution-specific tools) and I don't want to use any GUI tools.
I supposed that there is some file that is executed at login and I should just paste these commands there, but adding them to ~/.bash_login
didn't have any effect, similarly with ~/.bash_profile
. With ~/.profile
, only /usr/bin/setxkbmap -option "ctrl:nocaps"
had effect.
How can I achieve this?
Best Answer
Usually you put X related items that you'd like to run in the context of the user (you) in one of 2 files:
$HOME/.xinitrc
For GNOME desktops you can put commands in $HOME/.gnomerc
Alternative Approach
Some commands such as
Step #1xset
may not work from within these files. If you'd still like to automate something like this you may be able to add it as a "Startup Application".Create a shell script,
Step #2xset.bash
.Add a startup task to run the shell script.
Open the application Startup Applications, under System → Preferences
Then click the Add button
Once you're done OK & Close the dialogs and to test it out logout and log back in.
References