[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [STUMP] Changing keyboard layout... forth and back
From: |
Fabrice Niessen |
Subject: |
Re: [STUMP] Changing keyboard layout... forth and back |
Date: |
Wed, 21 Jan 2009 15:21:31 +0100 |
User-agent: |
Gnus/5.110009 (No Gnus v0.9) Emacs/23.0.60 (gnu/linux) |
Hi Shawn,
>>> prefix-key ("Super" or "Windows" key) followed by `C-i', I
>>> am By default, it is well in British English. If I press my
>>> in French layout. Good... Except my prefix-key becomes
>>> disabled...
>
> be used with stumpwm, setxkbmap resets it. So you should add
> an If you've used xmodmap to customize your windows key so it
> can additional call after setxkbmap to reload your xmodmap
> file or do whatever customizations you need to do.
That was the problem, as I said in my previous mail.
Something that works is the following:
--8<---------------cut here---------------start------------->8---
;; keyboard layout
(defvar *keyboard-layout* :qwerty-gb)
(run-shell-command "setxkbmap gb")
(run-shell-command "xmodmap -e \'clear Lock\' && xmodmap -e \'keycode 66 =
Tab\'")
(defcommand toggle-keyboard-layout () ()
(cond ((eq *keyboard-layout* :qwerty-gb)
(setf *keyboard-layout* :azerty-fr)
(message "Selected keyboard layout: France")
(run-shell-command "setxkbmap fr && xmodmap -e \'keycode 115 = F20\'
&& xmodmap -e \'clear Lock\' && xmodmap -e \'keycode 66 = Tab\'"))
((eq *keyboard-layout* :azerty-fr)
(setf *keyboard-layout* :qwerty-gb)
(message "Selected keyboard layout: United Kingdom")
(run-shell-command "setxkbmap gb && xmodmap -e \'keycode 115 = F20\'
&& xmodmap -e \'clear Lock\' && xmodmap -e \'keycode 66 = Tab\'"))))
(define-key *top-map* (kbd "Tab") "toggle-keyboard-layout")
--8<---------------cut here---------------end--------------->8---
The above code allows me to switch between keyboard layouts when
pressing the `Tab' or the `Caps_Lock' (66) key.
However, I would like to keep `Tab' as `Tab' (inserting some
space, or completing words under Emacs), and only have
`Caps_Lock' for switching the keyboard (preferably, with the LED
turning on and off, depending on the state).
The following code is a trial to do so (`Tab' -> `F19'):
--8<---------------cut here---------------start------------->8---
;; keyboard layout
(defvar *keyboard-layout* :qwerty-gb)
(run-shell-command "setxkbmap gb")
(run-shell-command "xmodmap -e \'clear Lock\' && xmodmap -e \'keycode 66 =
F19\'")
(defcommand toggle-keyboard-layout () ()
(cond ((eq *keyboard-layout* :qwerty-gb)
(setf *keyboard-layout* :azerty-fr)
(message "Selected keyboard layout: France")
(run-shell-command "setxkbmap fr && xmodmap -e \'keycode 115 = F20\'
&& xmodmap -e \'clear Lock\' && xmodmap -e \'keycode 66 = F19\'"))
((eq *keyboard-layout* :azerty-fr)
(setf *keyboard-layout* :qwerty-gb)
(message "Selected keyboard layout: United Kingdom")
(run-shell-command "setxkbmap gb && xmodmap -e \'keycode 115 = F20\'
&& xmodmap -e \'clear Lock\' && xmodmap -e \'keycode 66 = F19\'"))))
(define-key *top-map* (kbd "F19") "toggle-keyboard-layout")
--8<---------------cut here---------------end--------------->8---
But this does not work... The keyboard is not switched, and
`Caps_Lock' keeps its primary function of capitalizing the
letters I'm typing!
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...
Best regards,
Fabrice