Re: Can I switch CapsLock and Ctrl_L just for emacs sessions?
- From: Michal Nazarewicz <mina86@xxxxxxx>
- Date: Wed, 06 May 2009 21:10:45 +0200
Jerry Fleming <jerry@xxxxxxx> writes:
I was wondering if I can swtich CapsLock and Ctrl_L just for emacs
sessions, while in other applications (gnome-terminal, firefox, vim,
etc.) everything remains the same, simultaneously?
I am using a modified keymap to do this right now; it is very
inconvenient because not all applications have so many key bindings.
Is there a way to do this with some lisp code in my .emacs?
First question you should ask yourself is whether you need CapsLock at
all? I have turned CapsLock into yet another Control key and live happy
with that!
But if you decide you want CapsLock to be active, the only solution
I can think of is groups in X server. With proper configuration,
pressing by Shifts (for instance) will switch to another group. In one
group you may have Control and CapsLock switch and in another on the
same position. Here is part of my own xorg.conf (I assume you're using
X):
#v+
Section "InputDevice"
Identifier "Keyboard"
Driver "kbd"
Option "XkbModel" "pc105"
Option "XkbLayout" "pl,pl,pl"
Option "XkbVariant" ",dvorak,dvp"
Option "XkbOptions" "grp:shifts_toggle,grp_led:scroll,ctrl:nocaps"
EndSection
#v-
What you'll need to do is create a variant with those keys switched and
set it in XkbVariant modifying the rest to fit your layout (you may
configure up to four groups).
The same or similar can be achieved with some desktop managers if you
configure them to switch keyboard map by pressing some keys. Moreover,
you may prepare two scripts which feed xmodmap with proper data and run
them on command.
Unfortunately, none of those methods works the way you'd like it to:
they are not automatic -- you need to perform some action (ie. press
keys). On the other hand, some window managers allow running some code
when a window gains focus and that could be a way to go if you use such
a window manager (but that needs some coding of course).
I'm unaware of any better solution.
--
Best regards, _ _
.o. | Liege of Serenly Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +--<mina86*tlen.pl>--<jid:mina86*jabber.org>--ooO--(_)--Ooo--
.
- Prev by Date: Re: Simple question
- Next by Date: Re: Simple question
- Previous by thread: Simple question
- Next by thread: Unwanted characters in shell when listing directory.
- Index(es):
Relevant Pages
|