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?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Put it in ~/.Xmodmap. Some distro look for ~/.Xmodmap instead of ~/.xmodmaprc. It works for me on Fedora 16.
Method 2
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
Method 3
Put it in ~/.xsessionrc and make sure that /etc/X11/Xsession.options contains allow-user-xsession.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0