Permalink
Browse files

auto-detect proper vt for starting X

Now I can just run "xinit" and X does the right thing.
  • Loading branch information...
1 parent 1561f7d commit b7eac349ae2799382fb50db7f730c7362586c052 @falconindy committed Aug 26, 2012
Showing with 16 additions and 1 deletion.
  1. +1 −1 .xsession → .xinitrc
  2. +15 −0 .xserverrc
@@ -4,7 +4,7 @@
#
# launch a dbus session bus and write the location to file
-read machine_id < /etc/machine-id
+read machine_id </etc/machine-id
dbus-launch --autolaunch="$machine_id" --binary-syntax --close-stderr --exit-with-session
if [ -f "$HOME/.dbus/session-bus/$machine_id-${DISPLAY#:}" ]; then
. "$HOME/.dbus/session-bus/$machine_id-${DISPLAY#:}"
View
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+shopt -s extglob
+
+TTY=${TTY:-$(tty)}
+TTY=${TTY#/dev/}
+
+if [[ $TTY != tty+([0-9]) ]]; then
+ printf '==> ERROR: invalid TTY for this script\n'
+ exit 1
+fi
+
+printf -v vt 'vt%02d' "${TTY#tty}"
+
+exec /usr/bin/X -nolisten tcp "$vt" "$@"

0 comments on commit b7eac34

Please sign in to comment.