From: martin f. krafft Date: Sat, 13 Jan 2018 18:58:17 +0000 (+1300) Subject: switch xsetup to autorandr-based X-Git-Url: https://git.madduck.net/etc/xsession.git/commitdiff_plain/00d3aaa4438509e32247d91b7becb5d30d72bf08 switch xsetup to autorandr-based --- diff --git a/.bin/xconfig b/.bin/xconfig new file mode 100755 index 0000000..6d09d4a --- /dev/null +++ b/.bin/xconfig @@ -0,0 +1,40 @@ +#!/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 +} + +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 +echo >&2 " ] done." diff --git a/.config/autorandr/.gitignore b/.config/autorandr/.gitignore new file mode 100644 index 0000000..700f9ed --- /dev/null +++ b/.config/autorandr/.gitignore @@ -0,0 +1,3 @@ +!/postswitch +!/.gitignore +/* diff --git a/.config/autorandr/postswitch b/.config/autorandr/postswitch new file mode 100755 index 0000000..a5cfab7 --- /dev/null +++ b/.config/autorandr/postswitch @@ -0,0 +1,12 @@ +#!/bin/sh + +DELAY=5 + +echo >&2 Executing autorandr postswitch after $DELAY seconds… +sleep $DELAY +xconfig + +if command -v awesome-client >/dev/null; then + echo >&2 Restarting awesome… + echo "awesome.restart()" | awesome-client +fi diff --git a/.xsession.d/00-xsession b/.xsession.d/00-xsession new file mode 100644 index 0000000..f005d17 --- /dev/null +++ b/.xsession.d/00-xsession @@ -0,0 +1,9 @@ +if command -v autorandr >/dev/null; then + echo >&2 "Detecting and configuring XRandR setup…" + autorandr --force --change --skip-options gamma + +else + xconfig +fi + +# vim:ft=zsh diff --git a/.xsession.d/01-xkb b/.xsession.d/01-xkb deleted file mode 100644 index 1427ef9..0000000 --- a/.xsession.d/01-xkb +++ /dev/null @@ -1,12 +0,0 @@ -# load the keyboard definitions - -XKBDIR="$HOME/.xkb" -#XKBMAPFILE="$XKBDIR/keymap/${(%):-%M}" -XKBMAPFILE="$XKBDIR/keymap/$(hostname --fqdn)" -[ -r "$XKBMAPFILE" ] || XKBMAPFILE="${XKBMAPFILE%/*}/default" - -xkbcomp -w3 -I"$XKBDIR" "$XKBMAPFILE" "${DISPLAY%%.*}" - -unset XKBDIR XKBMAPFILE - -# vim:ft=zsh diff --git a/.xsession.d/01-xset-basics b/.xsession.d/01-xset-basics deleted file mode 100644 index 9680c26..0000000 --- a/.xsession.d/01-xset-basics +++ /dev/null @@ -1,8 +0,0 @@ -# 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 diff --git a/.xsession.d/01-xsetroot b/.xsession.d/01-xsetroot deleted file mode 100644 index aa2ab9b..0000000 --- a/.xsession.d/01-xsetroot +++ /dev/null @@ -1 +0,0 @@ -xsetroot -default diff --git a/.xsession.d/02-xresources b/.xsession.d/02-xresources deleted file mode 100644 index 0f58669..0000000 --- a/.xsession.d/02-xresources +++ /dev/null @@ -1,5 +0,0 @@ -# load .Xdefaults - -xrdb -load ~/.Xresources - -# vim:ft=zsh