Change an active Terminal's background color
TerryJ
listmail at exemail.com.au
Fri Feb 2 02:27:18 CET 2007
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 - - -
--
Regards, TerryJ
Using Xfce on PCLinuxOS. www.revivalcentres.org
More information about the Xfce
mailing list