Can I use different color setting (foreground and font) for each of the window that I create?

link|improve this question

74% accept rate
feedback

1 Answer

If you have a set of windows that you create when you start screen, you can put something like this into your .screenrc:

screen bash --init-file $HOME/.green
screen bash --init-file $HOME/.blue
screen bash --init-file $HOME/.red

The .red init file then contains:

# load standard bashrc file
. ~/.bashrc 

# set prompt and text color to red
export PS1="\e[0;31m[\u@\h \W]\$ \e[m "

A more general solution would use the WINDOW environment variable, which is set by screen when it creates a new window.

case $WINDOW in 
0)
   # red
   export PS1="\e[0;31m[\u@\h \W]\$ \e[m "
   ;;
1) 
   # blue
   export PS1="\e[0;34m[\u@\h \W]\$ \e[m "
   ;;
*)
   # no specific color
   export PS1="[\u@\h \W]\$ "
   ;;
esac
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.