File:  [NetBSD Developer Wiki] / wikisrc / tutorials / how_to_customize_keyboard_mappings_in_x.mdwn
Revision 1.2: download - view: text, annotated - select for diffs
Sun Feb 5 07:14:36 2012 UTC (8 years, 5 months ago) by schmonz
Branches: MAIN
CVS tags: HEAD
dos2unix

    1: How to readjust your keyboard map to your liking. 
    2: 
    3: **Contents**
    4: 
    5: [[!toc]]
    6: 
    7: #  Introduction 
    8: 
    9: Sometimes, esp. when working in an X environment, the default keyboard layouts aren't enough... 
   10: 
   11: #  xbindkeys 
   12: 
   13:   * Program that allows you to launch shell commands with your keyboard or mouse under X. It links commands to keys or mouse buttons. 
   14:     
   15:       cd /usr/pkgsrc/x11/xbindkeys
   16:       make install clean
   17:     
   18: 
   19: Create a default file 
   20:     
   21:       xbindkeys --defaults > $HOME/.xbindkeysrc
   22:     
   23: 
   24: Grab a key code 
   25:     
   26:       xbindkeys -k
   27:     
   28: 
   29: or 
   30:     
   31:       xbindkeys -mk
   32:     
   33: 
   34: for multi-keys respectively. 
   35: 
   36: ##  Examples 
   37: 
   38:   * .xbindkeysrc 
   39:     
   40:       # control+shift+d starts an xterm (it's a comment)
   41:       "xterm"
   42:         control+shift + q
   43:       # Menu key starts xbindkeys_show
   44:       "xbindkeys_show"
   45:         Menu
   46:       # Control + mouse button 1 starts an xterm
   47:       "xterm"
   48:         Control + b:1
   49:       # Control+Shift+a  release event starts rxvt
   50:       "rxvt"
   51:         release+control+shift + a
   52:       # Control + mouse button 2 release event starts rxvt
   53:       "rxvt"
   54:         Control + b:2 + Release
   55:     
   56: 
   57: #  xmodmap 
   58: 
   59:   * X utility for modifying keymaps and pointer button mappings. Call it from .xinitrc or .xsession, depending on whether you use 'startx' or the X display manager, like: 
   60:     
   61:        xmodmap ~/.xmodmaprc
   62:     
   63: 
   64: ##  German umlauts with en_US keyboards 
   65: 
   66:   * I use the [right-Alt]+[vowel] key combination. For that, add the following to your .xmodmaprc 
   67:     
   68:        ! Alt_R + aAeEoOuUs für Umlaute auf US-Tastaturen.
   69:        clear mod1             
   70:        add mod1 = Alt_L             
   71:        add mod3 = Alt_R                
   72:        keysym Alt_R = Mode_switch               
   73:        keysym  u    = u U udiaeresis      Udiaeresis              
   74:        keysym  a    = a A adiaeresis      Adiaeresis              
   75:        keysym  o    = o O odiaeresis      Odiaeresis                
   76:        keysym  s    = s S ssharp            
   77:     
   78: 
   79: ##  Swap Caps_Lock and Control_L 
   80: 
   81:   * This comes in handy esp. when using Emacs, screen and similar programs. 
   82:     
   83:       ! Swap Caps_Lock and Control_L
   84:       remove Lock = Caps_Lock
   85:       remove Control = Control_L
   86:       keysym Control_L = Caps_Lock
   87:       keysym Caps_Lock = Control_L
   88:       add Lock = Caps_Lock
   89:       add Control = Control_L
   90:     
   91: 
   92: Alternatively you can add in the InputDevice section of your keyboard in /etc/X11/xorg.conf (dunno if Xfree.conf works): 
   93:     
   94:       Option  "XkbOptions"    "ctrl:swapcaps"
   95:     
   96: 
   97: ##  Mouse emulation mode with Num_Lock 
   98:     
   99:       remove Lock = Num_Lock
  100:       add Lock = Control+Mod2 + Num_Lock

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb