You are not logged in.

#1 2011-11-03 14:04:36

darkjh
Member
Registered: 2011-10-21
Posts: 33

Problem disabling the capslock key

Hi, I switch to arch linux recently and as an emacs user it's very important to remap the capslock by ctrl. From the wiki I know the setxkbmap command but that seems not permenant: during the session the capslock randomly comes back ... Moreover I can't set it with the startup: I add it in the .xinitrc but nothing happens, even with the sleep command.

exec ck-launch-session startxfce4
sleep 8;setxkbmap -option "ctrl:nocaps"

Then I tried to add a file named 01-keyboard-layout.conf in the /etc/X11/xorg.conf directory:

Section "InputDevice"
  Identifier "IntergratedKeyboard"
  Driver "keyboard"
  Option "XkbOptions" "ctrl:nocaps"
EndSection

But nothing happens to the capslock and I can't launch my emacs...
So really confused by this, any suggestion on a better approach to remap this evil key permanantly?

###############################################################
###############################################################

Ok .... Finally I did it.

The problem is just like what I found, it's the XFCE-xkb-plugin that resets all the keyboard maps.
So I disable the plugin then creat a conf file in /etc/X11/xorg.conf.d and named 50-keyboard-layout.conf:

Section "InputClass"
  Identifier "Keyboard"
  Driver "evdev"
  Option "XkbLayout" "us,fr"
  Option "XkbOptions" "ctrl:nocaps,grp:alt_shift_toggle"
  MatchIsKeyboard "on"
EndSection

It details that I have two layouts (us,fr) and by using alt+shift I can toggle between them, and no XFCE plugins so the simple keymap just works.

Thanks again for helping me and I put it here in case some one else will find useful.

Last edited by darkjh (2011-11-11 00:30:47)

Offline

#2 2011-11-03 16:23:23

David Batson
Member
Registered: 2011-10-13
Posts: 640

Re: Problem disabling the capslock key

You should be able to do that with xmodmap.  Create a /home/~/.xmodmap file with the appropriate text (i.e. keysym nnn = Ctrl) [something like that - I don't know offhand if Ctrl is the proper name].  You can run xev in terminal to see what the current keysym number is for CapsLk.  You can press Ctrl while in xev to see how that key is mapped.  You can run xmodmap -pke in terminal to see all your current key mappings.

Offline

#3 2011-11-03 17:21:23

ak-89
Member
From: Finland
Registered: 2008-08-26
Posts: 86
Website

Re: Problem disabling the capslock key

$ cat /etc/X11/xorg.conf.d/50-keyboard.conf 
Section "InputClass"
  Identifier "Keyboard"
  Driver "evdev"
  Option "XkbLayout" "us"
  Option "XkbVariant" "altgr-intl"
  #Option "XkbVariant" "colemak"
  Option  "XkbOptions" "caps:backspace,eurosign:e"
  MatchIsKeyboard "on"
EndSection

I have set up caps as backspace and few other things with this config. Notice "InputClass" not "InputDevice".

Offline

#4 2011-11-03 23:09:16

darkjh
Member
Registered: 2011-10-21
Posts: 33

Re: Problem disabling the capslock key

ak-89 wrote:
$ cat /etc/X11/xorg.conf.d/50-keyboard.conf 
Section "InputClass"
  Identifier "Keyboard"
  Driver "evdev"
  Option "XkbLayout" "us"
  Option "XkbVariant" "altgr-intl"
  #Option "XkbVariant" "colemak"
  Option  "XkbOptions" "caps:backspace,eurosign:e"
  MatchIsKeyboard "on"
EndSection

I have set up caps as backspace and few other things with this config. Notice "InputClass" not "InputDevice".

Eh.. it works for the beginning but as the setxkbmap, the capslock randomly comes back... Very strange..

Last edited by darkjh (2011-11-03 23:23:37)

Offline

#5 2011-11-04 02:47:09

Ogion
Member
From: Germany
Registered: 2007-12-11
Posts: 367

Re: Problem disabling the capslock key

keycode 66 = Control_L
clear Lock
add Control = Control_L

I have this in .xmodmap, in .xinitrc i call "xmodmap ~/.xmodmaprc" this. It clears the capslock and puts a ctrl on the key.

Ogion


(my-dotfiles)
"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
"Enlightenment is man's leaving his self-caused immaturity." - Immanuel Kant

Offline

#6 2011-11-05 19:06:15

darkjh
Member
Registered: 2011-10-21
Posts: 33

Re: Problem disabling the capslock key

Ogion wrote:
keycode 66 = Control_L
clear Lock
add Control = Control_L

I have this in .xmodmap, in .xinitrc i call "xmodmap ~/.xmodmaprc" this. It clears the capslock and puts a ctrl on the key.

Ogion

I've tried all these method but none of them is permanent for me here, the caps lock just comes back after a while. When the system starts the key map is good but then it just comes back.

Offline

#7 2011-11-06 01:48:11

Ogion
Member
From: Germany
Registered: 2007-12-11
Posts: 367

Re: Problem disabling the capslock key

Very weird. That doesn't happen to me.
You are saying that, without restarting X/loggin out-back in, it just at some point reverts back to being Capslock?

Got any other programs doing some manipulation with the keymap running or something?

If not, i don't have an idea as to what it might be.

Ogion


(my-dotfiles)
"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
"Enlightenment is man's leaving his self-caused immaturity." - Immanuel Kant

Offline

#8 2011-11-06 20:59:15

darkjh
Member
Registered: 2011-10-21
Posts: 33

Re: Problem disabling the capslock key

Ogion wrote:

Very weird. That doesn't happen to me.
You are saying that, without restarting X/loggin out-back in, it just at some point reverts back to being Capslock?

Got any other programs doing some manipulation with the keymap running or something?

If not, i don't have an idea as to what it might be.

Ogion

It's nealy a new system here so not many programs. And even I start the system and just do nothing, some time later the evil key came back...
Is there any tool can track all the changes to the key map?

Offline

#9 2011-11-06 22:17:47

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: Problem disabling the capslock key

A shot in the dark: This could possible happen somewhere on system level. Which DE/WM do you use?
Are there any bash scripts which affect the key map settings?

Perhaps this helps: Follow top/htop after the system start (doing nothing else) if anything suspicious is called.


To know or not to know ...
... the questions remain forever.

Offline

#10 2011-11-07 23:03:12

darkjh
Member
Registered: 2011-10-21
Posts: 33

Re: Problem disabling the capslock key

bernarcher wrote:

A shot in the dark: This could possible happen somewhere on system level. Which DE/WM do you use?
Are there any bash scripts which affect the key map settings?

Perhaps this helps: Follow top/htop after the system start (doing nothing else) if anything suspicious is called.

Today I spent some time on it but just cant figure it out. When the system is up every thing is ok and no strange process. Then I tried every program/software that I have, just one time I launched nano and the caps lock key came back, but after that I repeated this (launching nano) for at least 50 times but it didn't happen anymore.
And it's like when the system is on for a while, maybe 30 minutes, the caps lock will come back...

I'm using XFCE4.8.

Offline

#11 2011-11-07 23:56:13

Tzbob
Member
From: Belgium
Registered: 2011-04-12
Posts: 61

Re: Problem disabling the capslock key

For me it comes back when I re-plug my keyboard, perhaps you've been plugging it in and out in these situations? feels like a long shot though.

Offline

#12 2011-11-08 01:36:20

GRem
Member
From: Asunción
Registered: 2010-08-20
Posts: 32

Re: Problem disabling the capslock key

I use an xmodmap script in autostart to remap my caps lock key to <.
Sometimes it does reset back, but re-running the script fixes it. I notice this does happen when I set the system to sleep. Do you have any power saving features that could be doing it?

If there's no other way, how about setting a keyboard shortcut that runs your script again? It you notice it's reverting, hit it to restore.

Offline

#13 2011-11-09 16:15:30

darkjh
Member
Registered: 2011-10-21
Posts: 33

Re: Problem disabling the capslock key

GRem wrote:

I use an xmodmap script in autostart to remap my caps lock key to <.
Sometimes it does reset back, but re-running the script fixes it. I notice this does happen when I set the system to sleep. Do you have any power saving features that could be doing it?

If there's no other way, how about setting a keyboard shortcut that runs your script again? It you notice it's reverting, hit it to restore.

I'm using the laptop-mode for some power-saving but it affects the keyboard map?
How to set a keyboard shortcut? I tried it with the tools of XFCE but it doesn't execute the command.

Offline

#14 2011-11-09 16:20:45

darkjh
Member
Registered: 2011-10-21
Posts: 33

Re: Problem disabling the capslock key

I'm been think that can I just alter the keyboard layout file to disable the caps lock key? If I can how should I do it?

Offline

#15 2011-11-09 16:48:41

GRem
Member
From: Asunción
Registered: 2010-08-20
Posts: 32

Re: Problem disabling the capslock key

darkjh wrote:

I'm using the laptop-mode for some power-saving but it affects the keyboard map?
How to set a keyboard shortcut? I tried it with the tools of XFCE but it doesn't execute the command.

Well, if the power saving makes the computer sleep, it might affect it.
As for the xfce shortcuts, setting something to run the script's file in keyboard preferences is enough. Maybe you need to chmod +x the file with your script?

Offline

#16 2011-11-10 22:24:51

darkjh
Member
Registered: 2011-10-21
Posts: 33

Re: Problem disabling the capslock key

I think I've found the cause, because I use xfce-xkb-plugin to change keyboard layout between fr and us ... And it seems this plugin detects all the keyboard mapping changes and reset it from time to time.

So really upset by this issue. Can I use another tool for keyboard layout change?

Offline

#17 2011-11-10 22:53:48

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: Problem disabling the capslock key

darkjh wrote:

I think I've found the cause, because I use xfce-xkb-plugin to change keyboard layout between fr and us ... And it seems this plugin detects all the keyboard mapping changes and reset it from time to time.

So really upset by this issue. Can I use another tool for keyboard layout change?

I use a launcher that runs the following bash script:

#!/bin/bash

if setxkbmap -query |grep -q "us$"
then
	setxkbmap carpalx
else
	setxkbmap us
fi

Alternately, I have bash aliases: asdf switches to carpalx and dstn (same keys) switches to us.  Both methods could be modified to 'reassert' your custom changes.

Last edited by alphaniner (2011-11-10 22:54:53)


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

Board footer

Powered by FluxBB