madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

switch xsetup to autorandr-based
authormartin f. krafft <madduck@madduck.net>
Sat, 13 Jan 2018 18:58:17 +0000 (07:58 +1300)
committermartin f. krafft <madduck@madduck.net>
Sat, 13 Jan 2018 18:58:17 +0000 (07:58 +1300)
.bin/xconfig [new file with mode: 0755]
.config/autorandr/.gitignore [new file with mode: 0644]
.config/autorandr/postswitch [new file with mode: 0755]
.xsession.d/00-xsession [new file with mode: 0644]
.xsession.d/01-xkb [deleted file]
.xsession.d/01-xset-basics [deleted file]
.xsession.d/01-xsetroot [deleted file]
.xsession.d/02-xresources [deleted file]

diff --git a/.bin/xconfig b/.bin/xconfig
new file mode 100755 (executable)
index 0000000..6d09d4a
--- /dev/null
@@ -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 (file)
index 0000000..700f9ed
--- /dev/null
@@ -0,0 +1,3 @@
+!/postswitch
+!/.gitignore
+/*
diff --git a/.config/autorandr/postswitch b/.config/autorandr/postswitch
new file mode 100755 (executable)
index 0000000..a5cfab7
--- /dev/null
@@ -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 (file)
index 0000000..f005d17
--- /dev/null
@@ -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 (file)
index 1427ef9..0000000
+++ /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 (file)
index 9680c26..0000000
+++ /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 (file)
index aa2ab9b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-xsetroot -default
diff --git a/.xsession.d/02-xresources b/.xsession.d/02-xresources
deleted file mode 100644 (file)
index 0f58669..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# load .Xdefaults
-
-xrdb -load ~/.Xresources
-
-# vim:ft=zsh