Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 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

2 Answers 2

up vote 1 down vote accepted

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

[Desktop Entry]
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


see here for details

share|improve this answer

Your Answer


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.