4

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?

1 Answer 1

1

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/.xsession
  • $HOME/.xinitrc

  • For GNOME desktops you can put commands in $HOME/.gnomerc

  • For KDE you put commands in $HOME/.kde/Autostart

Alternative Approach

Some commands such as xset 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".

Step #1

Create a shell script, xset.bash.

#!/bin/bash
xset r rate 120 66
Step #2

Add a startup task to run the shell script.

Open the application Startup Applications, under System → Preferences

                    ss of dialog #1

Then click the Add button

                                ss of add dialog

Once you're done OK & Close the dialogs and to test it out logout and log back in.

References

9
  • It doesn't work - the xset command still doesn't have any effect. Actually, maybe the problem is that it is overwritten by gnome settings? But how would i change that? Aug 8, 2013 at 13:04
  • @JanekWarchol - see updates.
    – slm
    Aug 8, 2013 at 17:58
  • It still doesn't work. I've put the command into my .gnomerc, .xinitrc and .xsession and there is no result (the files are marked as executable, so there should be no problems with that). What's probably most interesting is that i have another command in .gnomerc (xbacklight -set 70) and it works. Aug 10, 2013 at 12:20
  • Does xset work for you if you write it in these files? Aug 10, 2013 at 12:29
  • @JanekWarchol - I've never tried them 8-).
    – slm
    Aug 13, 2013 at 2:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .