#!/bin/sh set -eu config_xkb() { echo -n >&2 " xkb" local XKBDIR; XKBDIR="$HOME/.xkb" local XKBMAPFILE; XKBMAPFILE="$XKBDIR/keymap/$(hostname --fqdn)" [ -r "$XKBMAPFILE" ] || XKBMAPFILE="${XKBMAPFILE%/*}/default" xkbcomp -w3 -I"$XKBDIR" "$XKBMAPFILE" "${DISPLAY%%.*}" } config_xset() { echo -n >&2 " xset-basics" # i hate this bell!!! xset b 0 # power saving mode of the screen xset dpms 300 300 300 # typematic repeat rate xset r rate 255 47 } config_xsetroot() { echo -n >&2 " xroot" xsetroot -default } load_xresources() { echo -n >&2 " Xresources" xrdb -load ~/.Xresources } config_xinput() { echo -n >&2 " xinput" xinput set-float-prop "TPPS/2 IBM TrackPoint" "Device Accel Constant Deceleration" 0.7 2>/dev/null || : WIRELESS_RECEIVER=$(xinput | sed -rne 's,.*Lenovo USB Receiver[[:space:]]+id=([[:digit:]]+).*pointer.*,\1,p') if [ -n "$WIRELESS_RECEIVER" ]; then xinput set-button-map $WIRELESS_RECEIVER 1 2 3 4 5 6 7 0 0 0 >/dev/null || : fi } echo -n >&2 "Configuring X [" [ -n "${SKIP_XKB:-}" ] || config_xkb [ -n "${SKIP_XSET:-}" ] || config_xset [ -n "${SKIP_XSETROOT:-}" ] || config_xsetroot [ -n "${SKIP_XRESOURCES:-}" ] || load_xresources [ -n "${SKIP_XINPUT:-}" ] || config_xinput echo >&2 " ] done."