stumpwm-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [STUMP] Changing keyboard layout... forth and back


From: Shawn
Subject: Re: [STUMP] Changing keyboard layout... forth and back
Date: Wed, 21 Jan 2009 14:52:04 -0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

"Fabrice Niessen" <address@hidden> writes:

> But this does not work... The keyboard is not switched, and
> `Caps_Lock' keeps its primary function of capitalizing the
> letters I'm typing!

Funnily, I can't try this code since I dont have a single keyboard
with a capslock key on it. But I would recommend you try a few tests
first.

(define-key *top-map* (kbd "F19") "echo foo")

Does that work?

> Any idea on how to divert `Caps_Lock' from its primary function,
> and use it for switching my keyboard?  That key is indeed the
> only one I never use...

When you remove it from Lock, it shouldn't change the caps lock
state. But you should confirm that by running only the xmodmap -e
"clear lock" line without any other bindings and make sure that is the
case.

if all that checks out, then try only calling 'setxkbmap fr' and
'setxkbmap bg' in your command. Make sure that works. Etc, etc.

On a side note, I think this is equivalent to your function and is a
bit more readable (I haven't actually tested it though):

(defcommand toggle-keyboard-layout () ()
  (ecase *keyboard-layout*
    (:qwerty-gb
     (setf *keyboard-layout* :azerty-fr)
     (message "Selected keyboard layout: France")
     (run-shell-command "setxkbmap fr && xmodmap -e 'keycode 115 = F20' -e 
'clear Lock' -e 'keycode 66 = F19'"))
    (:azerty-fr
     (setf *keyboard-layout* :qwerty-gb)
     (message "Selected keyboard layout: United Kingdom")
     (run-shell-command "setxkbmap gb && xmodmap -e 'keycode 115 = F20' -e 
'clear Lock' -e 'keycode 66 = F19'"))))

-Shawn




reply via email to

[Prev in Thread] Current Thread [Next in Thread]