From: Julien Moutinho Date: Sat, 23 Mar 2013 20:39:15 +0000 (+0100) Subject: Ajout : vm_hosted : etc/{bash.bashrc,screenrc} : indication des personnes connectées. X-Git-Url: https://git.cyclocoop.org/?p=lhc%2Fateliers.git;a=commitdiff_plain;h=60b1249df146813f13a4d9bda6baeaf37dc0ee4a Ajout : vm_hosted : etc/{bash.bashrc,screenrc} : indication des personnes connectées. --- diff --git a/etc/bash.bashrc b/etc/bash.bashrc index ae5f5b1..02386c8 100644 --- a/etc/bash.bashrc +++ b/etc/bash.bashrc @@ -51,7 +51,16 @@ case $TERM in ;; esac . /etc/etckeeper/prompt.sh -PS1="$prompt_set_cursor\\[$tput_setaf_1$tput_bold\\]\$(prompt_etckeeper)\\[$tput_sgr0\\]$prompt_text" +prompt_users () { + local users="$(who -u | cut -d " " -f 1 | sort -u)" + test "$(printf "%s\n" $users | wc -l)" -lt 2 || { + users=$(printf "%s&" $users) + printf "%s@" "${users%&}" + } + } +prompt_text="\\[$tput_setaf_3$tput_bold\\]\$(prompt_users)\\[$tput_sgr0\\]$prompt_text" +prompt_text="\\[$tput_setaf_1$tput_bold\\]\$(prompt_etckeeper)\\[$tput_sgr0\\]$prompt_text" +PS1="$prompt_set_cursor$prompt_text" # NOTE: couleurs eval $(dircolors --bourne-shell) diff --git a/etc/screenrc b/etc/screenrc index f3194ef..75bfcae 100644 --- a/etc/screenrc +++ b/etc/screenrc @@ -30,10 +30,12 @@ termcapinfo xterm*|*rxvt* "" XT # NOTE: set these terminals up to be 'optimal' instead of vt100. termcapinfo xterm*|*rxvt*|Eterm* OP -backtick 1 0 0 hostname -backtick 2 0 84600 date '+%b' +backtick 1 0 60 sh -c 'users=$(who -u | cut -d " " -f 1 | sort -u); test "$(printf "%s\n" $users | wc -l)" -lt 2 || { users=$(printf "%s&" $users); printf "%s@" "${users%&}"; }' +# NOTE: show logged in users when not alone. +backtick 2 0 0 hostname +backtick 3 0 84600 date '+%b' hardstatus on -hardstatus alwayslastline "%{= kb} %-w%{kw}%n %t%{-}%+w %=%{..m} %{= kr}%1` %{kw}%D %d %2` %0c %{= dd}" +hardstatus alwayslastline "%{= kb} %-w%{kw}%n %t%{-}%+w %=%{..m} %{= ky}%1`%{= kr}%2` %{kw}%D %d %3` %0c %{= dd}" caption splitonly "%?%F%{= .bw}%:%{= .kw}%? %=%{..C}%n%{-} %t%= " sorendition wk