Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I don't understand scripts or how to make them or how to run them. All I want to do is run the command xmodmap -e "keycode 112 = Delete" when my computer starts. When I run this command in terminal, it remaps the PgDn key to be a second Delete key. But then I have to run it again every time I start the computer. How can I do this? I've tried adding it as a line in the rc.local file but it doesn't work.

share|improve this question
1  
Specifically for xmodmap commands there is another way of doing it: see my answer here, but placing it in startup applications is fine as well, as has been suggested. –  user76204 Jan 8 '13 at 14:02

2 Answers 2

You can make it run at boot by adding it in startup applications. Open startup applications from the dash. Click 'Add' and put xmodmap -e "keycode 112 = Delete" in the 'Command' field. Give it a name and comment if you want. Click 'Add' and login again.

enter image description here

share|improve this answer
    
for opening startup manager from Terminal , you can use this command :‌ gnome-session-properties –  Mehdi Maghrooni May 2 at 19:25

Seth's solution is a high-level solution that works fine as long as you don't change the desktop environment to something more exotic. To be on the secure side you might want to choose a method that acts at a lower level:

Open up a terminal (CTRL + ALT + T) and execute the following command:

echo "xmodmap -e \"keycode 112 = Delete"\" >> $HOME/.bashrc

This appends xmodmap -e "keycode 112 = Delete" to your .bashrc file and thus executes it on each login.

Edit: As Mik pointed out this might not be the best way of setting xmodmap up. See here for a better method.

share|improve this answer
1  
~/.bashrc is not read at startup when you login with lightdm, but ~/.profile is; so you could put it in there, or better still do what I suggested here. –  user76204 Jan 8 '13 at 14:16
    
@Mik I didn't know that. Thanks for pointing it out. I edited my answer accordingly. –  Glutanimate Jan 8 '13 at 14:32
    
Nice answer +1. –  Seth Jan 8 '13 at 16:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.