I want to turn off all key repeats when X starts up. I tried adding

xset r off

to /etc/X11/xinit/xinitrc, and to other files in the same area, but this doesn't seem to work. Executing the same command in a terminal once I've booted works as expected.

This is on centOS 6.5.

  • Which desktop environment, window manager and so on are u using? Jan 13, 2015 at 14:07
  • Gnome and Metacity on CentOS 6.5.
    – SixDegrees
    Jan 14, 2015 at 20:06
  • For GDM of Gnome there is /etc/gdm/Xsession which can do it; looking through it, we see that executable (+x) scripts in the directory /etc/X11/xinit/xinitrc.d/ should work (instead of a single file). Jan 14, 2015 at 22:41

1 Answer 1


To customize this, create your own in your home directory. Name it .xinitrc, make sure it is an executable script, and chmod +x.

TLDP - The X Window User HOWTO - Running X

Customization is done by a .xinitrc file in ~; if present, /etc/X11/xinit/xinitrc doesn't load.

The above TLDP HOWTO suggests that there is .xclients for situations without .xinitrc.

The order of loading the files works like this:

Startx typically runs without command line arguments, but command line arguments will override its normal behavior described below. It gets client arguments from one of:

  • .xinitrc in the user's home directory, if the file exists.
  • /etc/X11/xinit/xinitrc if the above file doesn't exist.
  • /usr/X11R6/lib/X11/xinit/xinitrc by default if the above two files don't exist.

How Linux X works

As the quote reveals; startx decides this, which is a shell script that can be customized.

  • I don't have any .xinitrc or .xsession files in my home directory. When I add the command to /etc/X11/xinit/xinitrc, it has no effect; keys continue to repeat.
    – SixDegrees
    Jan 13, 2015 at 13:13
  • @SixDegrees: What happens if you create those files in your home directory? If nothing; check the TLDP link above, there's a section about .xclients for certain situations like perhaps the one you experience. Jan 13, 2015 at 14:08
  • Works from my home directory. Note that the project, though, pretty much requires a global setting.
    – SixDegrees
    Jan 13, 2015 at 14:27
  • @SixDegrees: Do which startx; open that startx file in an editor, it is a shell script that passes these file locations to xinit (among other parameters) so you can make it do what you want to. If you happen to use something else than startx for starting X, there should be a similar script for that desktop environment or window manager (which may even be the rc script/systemd service file). Jan 13, 2015 at 14:57
  • Still no joy. startx indicates that it is reading the files I had previously modified, and adding 'xset r off' in startx immediately following the xinit call likewise has no effect. So I'm thinking there's some other set of init scripts being executed, but I don't know where they might be. And since I'm trying to turn off a low-level feature, it seems like I should be able to do this at the lever of X itself. Oddly, I can put the same command in /etc/profile.d, and it works, but tying it to the shell seems odd.
    – SixDegrees
    Jan 14, 2015 at 10:15

You must log in to answer this question.

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