From 018373e9222d939cad98a2264cf4d1eeeb0943dc Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Fri, 31 Jul 2009 09:52:18 +0200 Subject: [Env] Guess current display name --- 10_Environment.zsh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to '10_Environment.zsh') diff --git a/10_Environment.zsh b/10_Environment.zsh index 0009773..faef244 100644 --- a/10_Environment.zsh +++ b/10_Environment.zsh @@ -70,4 +70,16 @@ SAVEHIST=42000 export GPG_TTY=`tty` +# Display guess +CURRENT_DISPLAY=$(finger | tail -n+2 | grep -E $USER'[[:blank:]]+.*[[:blank:]]+tty[0-9][[:blank:]]+($DISPLAY)' | head -n1 | cut -d'(' -f2 | cut -d')' -f1) +if [ "$DISPLAY" = "" -o "$CURRENT_DISPLAY" = "" ] +then + GUESS_DISPLAY=$(finger | tail -n+2 | grep -E $USER'[[:blank:]]+.*[[:blank:]]+tty[0-9]' | head -n1 | cut -d'(' -f2 | cut -d')' -f1) + if [ "$GUESS_DISPLAY" != "" ] + then + export DISPLAY=$GUESS_DISPLAY + else + unset DISPLAY + fi +fi -- cgit v1.2.3