diff options
author | Hugues Hiegel <hugues.hiegel@openwide.fr> | 2009-07-31 09:52:18 +0200 |
---|---|---|
committer | Hugues Hiegel <hugues.hiegel@openwide.fr> | 2009-07-31 09:52:18 +0200 |
commit | 018373e9222d939cad98a2264cf4d1eeeb0943dc (patch) | |
tree | 7b0455d20850914dd0c546c57532a60ec849095d /10_Environment.zsh | |
parent | d92e40f3ae6db4694d3d78344c9530dc79b012cc (diff) |
[Env] Guess current display name
Diffstat (limited to '10_Environment.zsh')
-rw-r--r-- | 10_Environment.zsh | 12 |
1 files changed, 12 insertions, 0 deletions
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 |