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

Re: Lower-case parens



   Can you please post the non-x-windows keymap file
   also?

Chandra-

No trouble. Here you go. Feed the first five lines of 
    ! Swap () and []
    keycode 0x12 =  9               bracketleft
    keycode 0x13 =  0               bracketright
    keycode 0x22 =  parenleft       braceleft
    keycode 0x23 =  parenright      braceright

    ! Make the caps-lock key be a control key.
    clear Lock
    keycode 0x42 = Control_L
    add    Control = Control_L Control_R

    ! Alt_R is meta.
    add    Mod1    = Alt_R

    ! Swap escape and ~/`
    !keycode 0x09 =  grave           asciitilde
    !keycode 0x31 =  Escape		asciitilde

to xmodmap, and you'll swap [] & () on a PC keyboard. I put the stuff above
in a file .xmodmap.i686, which I load from inside my .xinitrc file as
follows:
    ;;; Shorthand
    (define $ getenv)
    (define ^ string-append)

    ;;; Hack the keyboard
    (cond ((let ((a ($ "ARCH"))) ;; Look for a file named .xmodmap.<arch>
	     (and a (let ((f (^ ".dots/xmodmap." a)))
		      (and (file-readable? f) f))))
	   => (lambda (keyhax) (run (xmodmap ,keyhax))))

	  ;; Look for a simple .xmodmap file
	  ((file-readable? ".dots/xmodmap")
	   (run (xmodmap .dots/xmodmap))))

Translated for sh, that's
    # Hack the keyboard
    # Look for a file named .xmodmap.<arch>
    if [ -r ".dots/xmodmap.$ARCH" ]; then
      xmodmap ".dots/xmodmap.$ARCH"
    # Look for a simple .xmodmap file
    elif [ -r .dots/xmodmap ]; then
      xmodmap .dots/xmodmap
    fi

This all assumes you defined an environment variable $ARCH to be a string
like "i686" or "sun4" when you logged in. If $ARCH isn't defined, you
just load a plain old ".xmodmap" file.
    -Olin