Re: Binding the WinDoze key

Greg Anderson (Nifft@FutureRealms.com)
Wed, 24 Mar 1999 23:16:07 -0500


David Mihm wrote:
> 
> On Mon, 22 Mar 1999, Greg Anderson wrote:
> 
> ! I would like to bind the Windoze key to pop up the pager
> ! and Alt-Windoze to pop up Wharf.  I have removed "StaysOnTop"
> ! for the pager and Wharf from the ~/GNUstep/Library/AfterStep/database
> ! to give me more screen real-estate.  I noticed that the key bindings
> ! are done in the ~/GNUstep/Library/AfterStep/feel.* files, but I don't
> ! know how to map my Windoze key or how to take that mapped key and
> ! attach it to an action that would pop my Wharf and pager to the
> ! foreground.
> !
> ! The feel.DEFAULT file seems to bind my WinDoze key to the Start
> ! menu:
> ! # Window keys
> ! Key Menu        A       A       Popup "Start"
> !
> ! except that it does not work, so my WinDoze key must need to be
> ! mapped somewhere else before the feel file can use it.  Has anyone
> ! done this?
> 
>         First off, I don't think you grasp what the 'PopUp' means here.
> It is for a menu, which was previously hardcoded as "Start" (as shown);
> 
> But the Menu key used above is the M$ keyboard key with the actual menu on
> it (or the right).  Further explanation of the Built-in command 'PopUp' is
> detailed in the man page for afterstep.
>         As for the actual key with the M$ logo 'Flying Window' on it; this
> is the Key Meta_L & Key Meta_R; or generally - the Meta key.
> 
>         Back to the issue of the question.  I would pressume (without
> prior testing) that using (as described in our beloved man pages, that
> someone has spent a great deal of time in updating for everyone to enjoy)
> something along the lines of:
> 
> Key <whatever>  <click location>  <context>  RaiseLower "name"
> 
> Try that and see what happens.  And ... if you need futher details, those
> man pages are pretty good at giving you information.
> 
>         Oh, and if your keyboard isn't letting you use these keys, then
> you have given X the wrong keyboard information when you configured it.

Ok, and thank you for your help.

Here's what I have figured out so far:

  My Menu and WinDoze_L, WinDoze_R keys need to be bound using xmodmap
first.  Then I can bind those keys in my feel files to actions.  Here's
how I did it.
1. Use xev to discover what your keycodes for your WinDoze_L and WinDoze_R
   and Menu Keys are. Running xev from an xterm pops up a window in your X 
   session.  Put your cursor over it and start pressing keys.  You will see 
   the keycode and the keyname for the keys you press listed in the xterm 
   you loaded xev from.  If the key you are testing is already bound to an
   AfterStep window managing event, you will not see it's key value 
   displayed in the xterm.  If you do not have xev, it is in the 
   X11R6-contrib-3.3.2-3.i386.rpm
   as of RedHat 5.2.  An excellent way to search for RPMs is with rpmfind.
   http://rufus.w3.org/linux/rpm2html/rpmfind.html
   It's a powerful searching utility that will find programs and the rpm
   they are contained in. Then rpmfind will even download the RPMs for you. 

2. Ok I know what the keycodes are now what?  Use xmodmap -pm to see what
   key modifiers are free.  You will need to use a key modifier to give
   your WinDoze keys names for X to bind to.  Mine looked like this:

xmodmap:  up to 2 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
control     Control_L (0x25),  Control_R (0x6d)
mod1        Alt_L (0x40),  Alt_R (0x71)
mod2        Num_Lock (0x4d)
mod3      
mod4      
mod5        Scroll_Lock (0x4e)

3. mod3 is free so I will use that one.  Create a ~/.xmodmaprc text 
   file and tell X what keynames you want those WinDoze keys mapped to.
   First run xmodmap -pke to get a list of current list of keynames.
   If your Meta_L and Meta_R are already mapped, (mine were), you may 
   wish to change the keys where your Meta_L and Meta_R are currently
   mapped.  After that configure your ~/.xmodmaprc map file. 
   Here's mine:
!keycode  64 = Alt_L Meta_L
!keycode 113 = Alt_R Meta_R
add mod3 = Menu
keycode  64 = 
keycode 113 = 
keycode  64 = Alt_L
keycode 113 = Alt_R
keycode 115 = Meta_L
keycode 116 = Meta_R
keycode 117 = Menu

   The ! marks are comments to xmodmap.  First my Meta_L and Meta_R were
   already mapped to my Alt keys.  I wanted my Meta keys mapped to my
   Windoze keys so I unset them and reset them.  I used the add command
   to create a keyname I could bind to my Menu key.  The menu key on my
   keyboard has a little picture of a menu and a pointer on it.

4. Finally I start my AfterStep from ~/.xinitrc so before calling After-
   Step I configure my keyboard for X.  Here's my ~/.xinitrc file:
xmodmap .xmodmaprc
exec afterstep

5. Now the keys are mapped and bound to X.  Next I need to tell After-
   Step about them.  That is done in the feel files.  I'm using the
   GNUstep/Library/AfterStep/feels/feel.DEFAULT file so that's where
   I need to bind the keynames to actions.

#Key Menu        A       A       Popup "pager"
#Key Menu        A       A       RaiseLower "pager"
Key Menu         A       A       RaiseLower "Wharf"
Key Meta_L       A       A       Popup "Start"
#Key Meta_L      A       A       WarpFore
Key Meta_R       A       A       WarpBack

   As you can see I tried Popup "pager" without success.  RaiseLower "pager"
   and RaiseLower "Wharf seem to ignore the "name" and just tab through the
   running apps in a single desktop frame.  Eventually the pager and Wharf
   come to the foreground when I do this, but I would really like to set the
   Menu key to pop the pager to the foreground.  If anyone knows what command
   I need to bind to my Menu key to do this, please post it:)  I also want to
   know how to pop the Wharf to the foreground. 

   After you make changes in your feel file, you must reselect it from your 
   Start menu to activate your changes.  (Start-Desktop-Feel-Feel.name)

   I highly recommend using a personal copy of the AfterStep configuration 
   files:
   cp -a /usr/local/share/afterstep/* ~/GNUstep/Library/AfterStep/

   And then backing them up like so:
   cd ~/
   tar -cvzf ASver1.tar.gz GNUstep

   Now make your changes and re-tar your GNUstep directory every now and again
   so you won't have to start from scratch if you muck something up. To
restore
   a backup copy:
   cd ~/
   rm -r -f GNUstep
   tar -xvzf ASver#.tar.gz
   Replace the ver# with whatever version number you are restoring.

6. I also removed a bunch of Alt + arrow bindings from feel.DEFAULT
# alt + arrow = 1/10 page
#Key Left        A       M       Scroll -10 +0
#Key Right       A       M       Scroll +10 +0
#Key Up          A       M       Scroll +0  -10
#Key Down        A       M       Scroll +0  +10
   These bindings move the pager frame around and prevent you from using
   the Alt + arrow  keys to navigate through news group and mail messages
   in Netscape.  Basically, if any of your application key bindings are being
   used by AfterStep, you can disable the AfterStep bindings or remap them
   in the AfterStep feel files.  Reload the feel from your start menu 
   (Start-Desktop-Feel-Feel.name) and your app will have it's key bindings 
   back.


7. Notes on using the AfterStep man pages.  When you are editing your feel 
   files you will find that the commands in the feel file are in the same 
   order as the commands documented in the man page.  That was a nice bit of
   forethought to help new users.  Open your feel file in one editor window 
   and your man page next to it and you can figure out how to make the 
   changes you desire.  Also note that the comments by the commands in the 
   feel file do not always agree with the command descriptions in the man 
   page.  When in doubt I followed the man page.  
   Ex:
feel.DEFAULT comment
# Uniconify to original place
StubbornPlacement

man page docs
StubbornPlacement  
Specifies  that  new  windows  should  avoid  being placed over icons.

That's it for now.  I'm not sure everything I said here was accurate. I know 
it seems to work for me, but if anyone has any suggestions or corrections to
this procedure, please post then to this list.  This could turn into a nice
FAQ item for new users.

Greg Anderson
http://www.FutureRealms.com

--
   WWW:   http://www.afterstep.org/
   FTP:   ftp://ftp.afterstep.org/
   MAIL:  http://www.caldera.com/linuxcenter/forums/afterstep.html