Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm using an aluminum Apple keyboard with my Mandriva 2010.2 Linux system. I remap the Apple Command key to Control using the following .Xmodmap file:

keycode 134 = Control_R
remove mod4 = Multi_key
add Control = Control_L Control_R Multi_key

If I allow xscreensaver to activate and run for some time, it appears to undo this remapping; I subsequently have to run xmodmap ~/.Xmodmap again manually. Is there any way to avoid this? I'm using xfce as my desktop environment.

share|improve this question
    
I've run into this before where things are able to reset any changes made by xmodmap after X starts and revert to the default X layout. VMware used to do this all the time. If I can remember what I did to fix it so that xmodmap wouldn't get over-written I'll get back to you on this. –  Caleb Jul 4 '11 at 9:53
add comment

migrated from serverfault.com Jul 3 '11 at 14:24

This question came from our site for professional system and network administrators.

2 Answers

A few years ago I used a PC keyboard with a Macintosh multi-booting Mac OS 9, Mac OS X and Linux. The windows key generated the same keycode as the Apple Command Key and showed up in linux as 'meta' or something. Try geekosaur's answer for mapping the windows key here.

Even if it is the wrong keycode, something very similar should do for you.

Edit: Example of xorg.conf section to map the Control function to the Windows keys according to geekosaur's instructions.

Section "InputDevice"
    Identifier  "Keyboard0"
    Driver    "keyboard"
    Option    "XkbLayout" "us"
    Option    "XkbOptions" "altwin:ctrl_win"
EndSection
share|improve this answer
    
Setting the mapping isn't the problem here, the problem is it is getting UN-set by something else. –  Caleb Jul 4 '11 at 9:51
    
This post describes how to make the change permanent when using xkb, but it seems that ~/.xkbmap or ~/.Xkbmap is not automatically parsed on my system when I start an X11 session. –  lebedov Jul 4 '11 at 13:42
    
@Caleb, the important bit from geekosaur is the 'Section "InputDevices" ... XkbOptions "altwin:ctrl_win" ... EndSection' in /etc/X11/xorg.conf. This avoids the ~/.Xmodmap not loading, rogue window managers, and xscreensaver cannot touch it. –  Magicianeer Jul 5 '11 at 4:25
add comment

You can simply permanently define another layout, or key bindings. Here:

how to assign another modifier to Alt key for X11?

share|improve this answer
add comment

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.