Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to execute this code on every login:

xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'

I tried to put this command into ~/.xsession or ~/.xinitrc but that doesn't work for me. In which file do I have to put this command?

I am using Gnome with Fedora 16.

Thanks for your help!

share|improve this question

migrated from stackoverflow.com Dec 5 '11 at 6:28

This question came from our site for professional and enthusiast programmers.

    
does it work if you just type it in the terminal? – Maxim Egorushkin Dec 4 '11 at 13:03
    
yes, that works – its-me Dec 4 '11 at 19:00
up vote 1 down vote accepted

Create a file ~/.config/autostart/xmodmap.desktop with the following contents:

[Desktop Entry]
Type=Application
Name=xmodmap
Exec=xmodmap -e 'Clear Lock' -e 'keycode 0x42 = Escape'

GNOME should then run that command on all subsequent logins.

share|improve this answer
    
with the line Type=Application it works. Thank you! – its-me Dec 6 '11 at 22:40
    
@its-me: Sorry about that; I'll fix it for future readers. Glad you got it working! – Patches Dec 7 '11 at 19:12

Since your using GNOME your probably using GDM and alternatively you can use

/etc/gdm/PostLogin/Default

see here for details

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .