Xmodmap doesn't run on startup?

I am trying to change the capslock key for an “F13” key so I can use it as sort of an app launcher key. I am doing this with xmodmap, by adding the following to my i3 config:

exec_always --no-startup-id sh xmodmap ~/.Xmodmap

This, however, doesn’t work at startup. I have also tried to add a “sleep” parameter, but it still doesn’t work. If I do reload the config file, it does work, but not until I do so! Doing that in the terminal also works. So, why is xmodmap not being run on startup?

I also tried adding the following to my .xinitrc:

xmodmap ~/.Xmodmap

to my .initrc. So my .initrc is as follows:

xmodmap ~/.Xmodmap
exec i3

But I don’t think lightdm (which EOS’s i3wm uses) uses xinitrc.

Any suggestions?

Is that a script you are trying to run?

echo "Running xmodmap" > ~/tmp.txt
xmodmap ~/.Xmodmap # << Might need an & ???
echo "xmodmap has run" >> ~/tmp.txt

Give it a name, make it executable and call in your config. Check the contents of the txt file - what do you get?

1 Like

.xinitrc it should be named :wink: and yea we do use lightdm.
But it will be used if you need:


nano ~/.xinitrc

[[ -f ~/.Xmodmap ]] && xmodmap ~/.Xmodmap

1 Like

Adding it to .xinitrc simply does not work.

I tried the script by @xircon and I do get “xmodmap has run”, though it still doesn’t work. It did work 1 time though, for some reason? Or am I going mad?. This is so weird.

xmodmap ~/.Xmodmap does work if you run manually from terminal?

Yes, that’s how I have been doing.

exec_always --no-startup-id xmodmap ~/.Xmodmap
should be good it does not need sh ?