13

I want to run this command every time I log in (or every time I start up, if that doesn't work): xmodmap -e 'keysym Delete = Menu' -e 'keysym Menu = Delete'

I've tried many things. I put the command in System > Preferences > Startup Applications. I put it in a .sh file, marked it chmod +x and put that file in System > Preferences > Startup Applications. I put the script in /etc/init.d. I put the commands in ~/.profile. Nothing seems to work.

Finally, I put this in my ~/.profile:

touch test1
xmodmap -e 'keysym Delete = Menu' -e 'keysym Menu = Delete'
touch test2

Both test1 and test2 get created, but the keys are still not remapped. If I just copy/paste the command and run it manually, it works fine. But it won't run on login. Any ideas?

Matthew
  • 5,537

3 Answers3

6

Put it in ~/.Xmodmap. Some distro look for ~/.Xmodmap instead of ~/.xmodmaprc. It works for me on Fedora 16.

5

Depending on your distribution the ~/.xsession file is executed (a shell script) when logging into X. And/or the ~/.Xmodmap file is sourced by an xmodmap process.

The ~/.profile file is only executed by a login shell (with or without X), thus it is not the right place

maxschlepzig
  • 57,532
1

Put it in ~/.xsessionrc and make sure that /etc/X11/Xsession.options contains allow-user-xsession.