You are not logged in.
It keeps switching back. Here's my .bashrc:
# Check for an interactive session
[ -z "$PS1" ] && return
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
xmodmap ./.xmodmap
Here's .xmodmap:
!
! Swap Caps_Lock and Control_L
!
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L
I'm using KDE. The keys switch back and forth seemingly randomly. Haven't figured out when or why...
EDIT: System Settings > Input Devices > Keyboard > Advanced > Ctrl key position > Swap Ctrl and Caps Lock
I guess KDE didn't care what xmodmap or setxkbmap were doing.
Last edited by YAOMTC (2011-03-19 05:22:17)
Offline
I used to have issues with xmodmap (every now and then it didn't load my config properly), until I started loading it together with X (/etc/X11/xorg.conf.d/20-xkmap.conf). Since then I haven't experienced any problems. Maybe you can give it a shot, too? This is how it looks (of course, you have to use your own mapping):
Section "InputClass"
Identifier "xkmap keyboard settings"
MatchIsKeyboard "yes"
#MODEL:
Option "XkbModel" "pc101"
#LAYOUT:
Option "XkbLayout" "us"
Option "XkbOptions" "caps:escape, terminate:ctrl_alt_bksp"
#VARIANT:-
#
EndSection
Last edited by bohoomil (2011-03-15 19:41:32)
:: Registered Linux User No. 223384
:: github
:: infinality-bundle+fonts: good looking fonts made easy
Offline
Nothing unusual here. Your caps lock and control will switch every time you start a new interactive shell session. xmodmap isn't meant to be invoked by .bashrc. Use a file that's invoked once at X startup like .xinitirc or .xsession (depending on how you start X).
Offline
I actually had this problem before I moved the line from .xinitrc to .bashrc. And now that I've moved it back and restarted, it's still happening...
Offline
You shouldn't use xmodmap to remap capslock, this sometimes causes problems when xmodmap is executed before the X-server has fully started. You can put
setxkbmap -option ctrl:swapcaps
in your .xinitrc instead.
Offline
Hmm... Now they're not switching at all... :S
Offline
Have you tried setxkbmap in a running X-session and does it give any errormessages?
Offline
portix' suggestion worked for me. Pretty neat!
Offline
setxkbmap gives no errors, and `setxkbmap -option ctrl:swapcaps' works fine when I run it. But it doesn't seem to have any effect when I put it in .xinitrc.
If it makes any difference, I log in with KDM.
Offline
I think I found the solution. If I go to KDE's System Settings, then Input -> Keyboard -> Advanced, I can swap Ctrl with Caps Lock. I guess KDE doesn't play nice with xmodmap/setxkbmap changes?
Offline
Anyone knows how to use xmodmap to rebind caps lock to left ctrl? Seems like the parsing changed recently (a new version affected it?) and it stopped working after booting with that version...
edit: nvm, it's ok to use xsetkbmap first xmodmap after it, like this:
xinit: setxkbmap -option ctrl:nocaps
Xmodmap: keysym y = z
keysym z = y
Last edited by archman-cro (2011-05-12 16:06:59)
Offline