Linux – Openbox overwrites xmodmap configuration

linux-mintopenboxxkbxmodmap

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?

Update:

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

#!/bin/bash

{
    echo '-------'
    date
    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.

#!/bin/bash

# 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)

#!/bin/bash

setxkbmap -option ctrl:nocaps

exec openbox-session

Best Answer

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.

Related Question