warbo-utilities: 98d656c5fc0fccfa5c63312af737d9fb1528fb04

     1: #!/usr/bin/env bash
     2: set -e
     3: set -o pipefail
     4: 
     5: # Reduce 'Emacs pinky', caused by the position of Ctrl on PS/2 keyboards
     6: 
     7: # Don't do anything if X isn't running
     8: xdotool get_desktop > /dev/null || {
     9:     echo "No DISPLAY '$DISPLAY', skipping" 1>&2
    10:     exit 0
    11: }
    12: 
    13: # Stop keybindings and remappers if running
    14: s2cctl  stop                  || true
    15: killall s2c       > /dev/null || true
    16: killall xbindkeys > /dev/null || true
    17: 
    18: # Put Ctrl back to the correct place on the PS/2 layout. This is where Caps
    19: # Lock is, so we map that to Ctrl. And nothing of value was lost.
    20: # These can be set by configuration.nix in NixOS, but get reset by Xrandr.
    21: 
    22: # Which machine are we on?
    23: HOST=$(hostname)
    24: 
    25: if [[ "$HOST" = "olpc" ]]
    26: then
    27:     # OLPC has a US keyboard, with ctrl in a sensible place
    28:     setxkbmap -option  # Reset options
    29:     setxkbmap -layout us
    30: else
    31:     # We assume everything else is GB with silly ctrl placement
    32:     setxkbmap -layout gb -option ctrl:nocaps
    33: fi
    34: 
    35: xbindkeys           # Hotkeys for volume, etc.
    36: s2cctl start        # space2ctrl: makes holding spacebar act like ctrl
    37: xmodmap ~/.Xmodmap  # Custom remappings

Generated by git2html.