xmodmap is the traditional way to remap a keyboard, but it's rather simplistic 
and was replaced by XKB years ago. xmodmap isn't supported. The option you want 
for XKB is ctrl:swapcaps and to set that from the command-line is with 
"setxkbmap -option ctrl:swapcaps". You will need to somehow run that command on 
every login, but it should take effect immediately. There is no need to log out 
or reboot which would actually undo the effects of that command. You can find a 
full list of options by looking in the XML file 
/usr/share/X11/xkb/rules/base.xml. All desktop environments look through that 
file to generate their fancy menus, but then just generate a long "setxkbmap" 
command which gets run when the desktop starts at each login.

On Feb 10, 2014, at 3:45 AM, Victor Soich <[email protected]> wrote:

> Hi Paul and all,
> 
> I guess I have Debian wheezy with a desktop of "default", the latter
> being lame information!
> 
> victor@claudius:~$ lsb_release -a
> No LSB modules are available.
> Distributor ID:    Debian
> Description:    Debian GNU/Linux 7.2 (wheezy)
> Release:    7.2
> Codename:    wheezy
> victor@claudius:~$ echo $DESKTOP_SESSION
> default
> 
> 
> 
> So through the menu I went to Applications, System Tools, Preferences,
> System Settings, then clicked on Details, and a Window came up,
> entitled "Details".  Under "Overview, it said Gnome version 3.4.2
> This is a bit annoying, because I thought I had xfce, but what do I
> know.....
> 
> 
> 
> I went to
> http://www.emacswiki.org/emacs/MovingTheCtrlKey
> and tried the following....
> 
> On Debian GNU/Linux (console-setup method, newer)
> 
> To make CAPS LOCK another control key, edit the file
> /etc/default/keyboard and change the line which reads
> 
> XKBOPTIONS=""
> 
> to
> 
> XKBOPTIONS="ctrl:nocaps" # Some people prefer "ctrl:swapcaps"
> 
> To make the change effective:
> 
> $ sudo dpkg-reconfigure -phigh console-setup
> 
> except I switched to root, i.e. not sudo, and executed
> dpkg-reconfigure -phigh console-setup   and nothing seemed to happen.
> 
> 
> So through the menu I went to Applications, System Tools, Preferences,
> System Settings, then clicked on the keyboard icon.  Then in the
> keyboard dialog box, I clicked on a link in the lower left corner,
> Layout Settings, and got a new dialog box, then went to an Options
> button, and finally got a keyboard layout options dialog box, clicked
> on Ctrl key position, and checked the checkbox, Swap Ctrl and Caps
> Lock.
> 
> The above was tedious, and I wanted to do things from the command line.
> 
> Then I logged out and logged back in, and nothing happened.
> Then I shut down the laptop, started it again, logged in again, and it
> worked!!  My caps lock key and my ctrl key are switched.
> 
> But, alas, I am not happy.
> I wanted to do this from the command line.  I tried two different
> ways, and it didn't work.  I am trying to learn emacs, and not have
> emacs pinky, and not remove my hands from the keyboard, and to not use
> a mouse.  A long term goal is to be comfortable using the command
> line, and I failed to configure my caps lock key ctrl key through the
> command line.  I had to resort to a graphical user interface.
> 
> I would like to know how I could have done this from the command line.
> I've tried two different ways.  Does anyone have an idea how I should
> do this?
> 
> Just to emphasize, I'm trying to make a commitment to emacs, and
> typing quickly without removing my hands from the keyboard.  A
> concomitant goal is to be comfortable at the command line.  That's why
> I'm harping on knowing how to configure my keyboard using emacs and
> the command line.  On an even more generalized note, can someone give
> me a quick pointer on what to read to get xfce on my machine, how to
> log into it instead of gnome.  How to log into a terminal instead of
> gnome or xfce.  Please don't tell me to just RTFM.  I maintain that I
> tried to find the proper way to modify my keyboard from the command
> line from the internet, and I tried two different ways, and was
> unsuccessful.  In an analogous way, can I get a pointer on what to
> read to do those things mentioned earlier in the paragraph, i.e log
> into xfce, terminal, as opposed to gnome.  I earnestly hope I'm not
> coming off as petulant.  I just spent a couple of somewhat angst
> ridden hours trying to modify my keyboard!  I'd simply want a pointer
> or two so I don't follow some red herrings.
> 
> Sincerely,
> Victor Soich
> 
> On Mon, Feb 10, 2014 at 12:21 AM, Paul Mullen <[email protected]> wrote:
>> On Sun, Feb 09, 2014 at 11:54:47PM -0800, Victor Soich wrote:
>>> victor@claudius:~$ cat .xmodmap
>>> !
>>> ! Swap Caps_Lock and Control_L
>>> !
>>> remove Lock = Caps_Lock
>>> remove Control = Control_L
>>> keysym Control_L = Caps_Lock
>>> keysym Caps_Lock = Control_L
>>> add Lock = Caps_Lock
>>> add Control = Control_L
>>> victor@claudius:~$ cat .bash_profile
>>> xmodmap ~/.xmodmap
>> 
>> Your .xmodmap looks correct.  I don't think you want to be loading it
>> from ~/.bash_profile, though.  You only want it to run once, when you
>> start a new X session (i.e., login to your desktop).  In the old days,
>> that meant adding "xmodmap ~/.xmodmap" to your ~/.Xsession file.  But
>> those fancy-shmancy integrated desktop environments everybody likes so
>> much these days (GNOME, KDE, XFCE, etc.) often have their own way of
>> enabling users to run command lines automatically when they log in.
>> Creating an ~/.Xsession file may break things (temporarily).  It'd be
>> best for you to determine exactly what desktop environment you're
>> using before proceeding.
>> 
>> 
>> --
>> Paul
>> _______________________________________________
>> PLUG mailing list
>> [email protected]
>> http://lists.pdxlinux.org/mailman/listinfo/plug
> _______________________________________________
> PLUG mailing list
> [email protected]
> http://lists.pdxlinux.org/mailman/listinfo/plug
> 

_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to