stumpwm-devel
[Top][All Lists]
Advanced

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

Re: [STUMP] gnome-panel doesn't notice killed windows?


From: Fabrice Niessen
Subject: Re: [STUMP] gnome-panel doesn't notice killed windows?
Date: Fri, 23 Jan 2009 09:41:38 +0100
User-agent: Gnus/5.110009 (No Gnus v0.9) Emacs/23.0.60 (gnu/linux)

Hi Shawn,

>> 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?

--8<---------------cut here---------------start------------->8---
(run-shell-command "setxkbmap gb && xmodmap -e 'keycode 115 = F20' -e 'clear 
Lock' -e 'keycode 66 = F19'")
(define-key *top-map* (kbd "F19") "echo foo")
--8<---------------cut here---------------end--------------->8---

Yep, this does 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) [...].

Thanks a lot as well for your side note. I like readable code,
and I like to learn new ways to improve it. Thanks for that!

FYI, the following code, adapted (following your advice) from my
previous code is perfectly working now:

--8<---------------cut here---------------start------------->8---
;; keyboard layout
(defvar *keyboard-layout* :qwerty-gb)
(run-shell-command "setxkbmap gb && xmodmap -e 'keycode 115 = F20' -e 'clear 
Lock' -e 'keycode 66 = F19'")

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

(define-key *top-map* (kbd "F19") "toggle-keyboard-layout")
--8<---------------cut here---------------end--------------->8---

The shorter version of xmodmap calls seems to behave better than
the previous one!?

The only missing part -- if I compare to what I had under Gnome --
is that, now, the Caps_Lock LED is not turned on anymore,
when pressing on Caps_Lock.

No using the mode-line feature, I have no visual indicator
anymore of the keyboard layout I'm in.

Any idea on how to solve this?

Best regards,
  Fabrice

-- 
Fabrice Niessen
Search the Web with "My Google Search Tools" on http://www.MyGooglest.com





reply via email to

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