I am setting up openbox on my laptop running Linux Mint 13. I want my Caps Lock key to act as an additional control key. I put the required settings in my ~/.Xmodmap file and checked it by running

xmodmap ~/.Xmodmap

It works correctly.

However when I relogin to my openbox session, these key changes are not present. Running the above xmodmap command gets it working again, but I want it to happen automatically at startup.

What's interesting is that I added a test zenity command as following to my ~/.config/openbox/autostart file

zenity --info --text=Hello

This produces a small dialog window and exits only after the dialog is closed.

Now, when I relogin to my openbox session, the Caps Lock acts as a Ctrl key, until the zenity dialog is closed. Once that dialog is closed, the Caps Lock returns to its default behavior.

I haven't found anything on this with google so I'm asking for help here. Do you guys have any ideas on what might be going wrong?


I have been trying to figure this out and in my experiments, I copied my /usr/bin/xmodmap file to /usr/bin/xmodmap_ and replaced the /usr/bin/xmodmap file with the following bash script


    echo '-------'
    echo xmodmap "$@"
} >> ~/xmodmap-calls

exec /usr/bin/xmodmap_ "$@"

So, every time any damn script on the system runs xmodmap, I get to know it.

With this, I relogin and I only find one entry in my ~/xmodmap-calls file, which is the one running my ~/.Xmodmap, which is expected. So, I figured its not a xmodmap that is overwriting my changes.

Next, a bit of googling introduced me to the setxkbmap command, which apparently can also do the same thing. I replaced that executable also, similar to xmodmap above. And I got the culprit command!

setxkbmap -option terminate:ctrl_alt_bksp

I have absolutely no idea what that does, but after running xmodmap ~/.Xmodmap (which applied my settings correctly), if I run the above command, my changes are reset! Edit: This is turning out real funny. Just a setxkbmap command without any arguments, happily overwrites my changes by the xmodmap ~/.Xmodmap command.

Now I have two things to figure out, where is this setxkbmap being run from & why and how to fix this. I'm still investigation but could seriously use some help :)

Update 2

To hell with xmodmap. I can't figure out where the setxkbmap is being called from, but I figured a way to use setxkbmap command to make my Caps Lock behave as Ctrl.

setxkbmap -option ctrl:nocaps

Just before starting openbox. Works brilliant. The caps lock key stays acting as a ctrl key. xmodmap is never run.

I'll keep this question here open so someone who knows these things can provide some insight. Also, for people who face this after me :)

Update 3

Here's the contents of my .config/openbox/autostart, as requested by pedrosaurio.


# Set the wallpaper.
feh --bg-scale /wall.png

# Set default brightness.
xbacklight -time 1 '=40'

# Compositing.
xcompmgr &

# The panel.
tint2 &

# Start a terminal too.
roxterm &

This doesn't have anything to do with the keyboard, as far as I can tell. Also, here's the script that starts my session: (Run by lightdm)


setxkbmap -option ctrl:nocaps

exec openbox-session
  • you are probably using some kind of keyboard configuration, e.g. choose the keyboard layout or something similar which reverts your applied changes Commented Jul 22, 2012 at 1:46
  • The only other place I fiddled with keyboard configuration is the GUI keyboard layout preferences window, where I changed the caps lock key to behave as an additional ctrl. That works fine, in the cinnamon DE, my caps lock acts as a ctrl even after a relogin. I think that configuration was cinnamon-only, but I'm not sure.
    – sharat87
    Commented Jul 22, 2012 at 2:33
  • how are you adding the command in the autostart script? Commented Jul 23, 2012 at 10:59
  • Can you post your autostart file? Commented Jul 23, 2012 at 15:07

2 Answers 2


I was experiencing a similar problem. It turned out that it was caused by ibus. I simply uninstalled it as I don't need its services.

I found the culprit by using your trick of replacing setxkbmap by a script, however I also added ps -AF --forest to identify the caller of setxkbmap.


Without knowing your autostart script my bet is that you are not using the proper syntax by letting your commands run in the background using the ampersand (&).

Try editing your .config/openbox/autostart file so it looks like this:

# Run the system-wide support stuff
# Programs to launch at startup
# Programs that will run after Openbox has started
(sleep 1 && xmodmap ~/.Xmodmap ) &

If in doubt have a look in the openbox wiki and see how all the examples have & after each entry.


  • My autostart file is empty. At a point I did have xmodmap ~/.Xmodmap in that file (without an &, didn't seem necessary). I have been calling xmodmap (and now setxkbmap) in the script that start my openbox session. Just before running exec openbox-session, I run the setxkbmap command.
    – sharat87
    Commented Jul 23, 2012 at 14:32
  • Also, adding a sleep 1 delay so that xmodmap applies its changes after everything else loads is, while works most of the time, doesn't make me feel too confident about the solution. I'd prefer not to do it, if I have alternatives.
    – sharat87
    Commented Jul 23, 2012 at 14:34
  • You can avoid obviously all the comments and the sleep command, nevertheless the & is necessary after each entry, otherwise all the programs after the first entry will not run at all. Commented Jul 23, 2012 at 15:01
  • Yes, if its a long running app/process, not adding a & will make it block. I used this behavior with the zenity command to find that my xmodmap changes are being overwritten after autostart finishes. My autostart is now growing in size and will paste it in the question in a moment. It doesn't have anything to do with the keyboard, though.
    – sharat87
    Commented Jul 23, 2012 at 16:45
  • And, without the sleep command, the changes made by xmodmap are overwritten as soon as the autostart file finishes.
    – sharat87
    Commented Jul 23, 2012 at 16:50

You must log in to answer this question.

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