Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

howto change screen hardstatus dynamically with format, from shell ? I successfully configured screen using 256 colors and tabs and so on, here is my .screenrc : http://pastebin.com/g8XbMWBH

I use the caption for the tabs, and the hardstatus as the way it's meant to be: a messaging status line.

what I wanna do is simple: showing colored messages on hardstatus, from shell scripts returns.

Here is what I managed to do at this point:

# changing xterm window title:
echo -e '\033k'window_title'\033\\'
echo -ne "\ek window_title\e\\"

# sending non colored messages to hardstatus:
echo -ne "\e! hardstatus_global_message\e\\"
echo -ne "\e^ hardstatus_private_message\e\\"

# reformating the hardstatus string:
echo -ne "\e]0; %{.BW}%{..G}colored hardstatus try\e\\"
echo -ne "\e_ %{.BW}%{..G}colored hardstatus try\e\\"

The escape codes are available here: http://yz.kiev.ua/www/etc/screen-virt-term.txt

i still don't see how to reformat the hardstatus string, nor how to send color codes to it, nor if it's even possible or not ? searched here and everywhere for hours, now i'm tired and asking, thanks !

share|improve this question

1 Answer 1

It is possible to color the hardstatus strings as you are saying. When using the color codes as a script output, you need to use a special ASCII character (005) to escape the color codes, instead of the percent sign (%) that you would normally use in your .screenrc file. In an example script you would have something like this:

#script.sh
Black="\005{K}"
Red="\005{R}"
Green="\005{G}"
Yellow="\005{Y}"
Blue="\005{B}"
Purple="\005{M}"
Cyan="\005{C}"
White="\005{W}"

echo -ne "Here is$Green Green$White text."

Then, in your .screenrc file, as you may already know, call the above script with a backtick command:

# .screenrc
backtick 101 5 5 /path/to/script.sh

hardstatus alwayslastline "%101`"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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