[OT] Re: Change an active Terminal's background color

Mike Massonnet mike.massonnet at gmail.com
Fri Feb 2 13:47:19 CET 2007


On Fri, Feb 02, 2007 at 12:27:18PM +1100, TerryJ wrote:
> Harold Aling wrote:
> > Harold Aling wrote:
> >> Current .bashrc config:
> >>
> >> ssh () {
> >>         xtermOldBG=`xtermcontrol --get-bg`
> >>         xtermcontrol --bg="darkred"
> >>         command ssh "$@"
> >>         xtermcontrol --bg=${xtermOldBG}
> >> }
> >>
> >> sudo () {
> >>         xtermOldBG=`xtermcontrol --get-bg`
> >>         xtermcontrol --bg="darkblue"
> >>         command su*do* "$@"
> >>         xtermcontrol --bg=${xtermOldBG}
> >> }
> >>
> >>   
> > (fixed small typo in sudo command)
> 
> I use this function (monkey see, monkey do - I don't understand it) in 
> /etc/bashrc.  After I su to root in Terminal, the colour of the prompt 
> changes to red.  I imagine you can alter backgrounds in the same way - 
> as long as your system has that file.  I don't know whether such 
> functions can be made to work in .bashrc - I tried it unsuccessfully in 
> Vector.
> 
> - - - code - - -
> function setprompt
> {
> local RED="\[$(tput setaf 1)\]"
> local RESET="\[$(tput sgr0)\]"
> if [ `id -u` = 0 ] # check if user is root
> then
> PS1="$RED[\u@\h:\W]$RESET "
> else
> PS1="[\u@\h:\W]$RESET "
> fi
> }
> setprompt
> 
> - - - end - - -

Yet another "I do", I do this in my .zshrc:

if [ "$SSH_CONNECTION" != "" ]
  then
    HOST="`hostname`/ssh"
    PROMPT=$'%U'$HOST'%u[%B%h%b]:%B%c%b%% '
    unset HOST
    alias halt='echo Are you sure?'
else
    PROMPT=$'%U%m%u[%B%h%b]:%B%c%b%% '
fi
RPROMPT=$'[%D-%T]'

-- 
 Mike (m8t) Massonnet http://massonnet.org/     __oo 
 GnuPG 0--" 0xF8C80F97                      ---(_)_"> 
 C4DA 431D 52F9 F930 3E5B  3E3D 546C 89D9 F8C8 0F97 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://mail.xfce.org/pipermail/xfce/attachments/20070202/16b9bbe2/attachment.pgp>


More information about the Xfce mailing list