GNU screen status line and other settings

Sep 27, 2009 20:30


Originally published at Dom's Blog. You can comment here or there.

Here is the screen configuration file I use on my laptop, it sets the window title, defines the status line showing how much battery remains and the clock, and a few other useful defaults.



Note: I tend to run the terminal fullscreen, so I can’t see the clock on the menubar

The variable termcapinfo determines the title of a window in which this screen session is viewed.

The three scripts defined as backticks are for the battery percentage remaining, time remaining and current temperature, these are included in the last line of the terminal using the syntax %1` for the first, %2` for the second and so on, the backtick after the number is part of the string.

The status line of screen is described by “hardstatus alwayslastline”, consisting of a list of each screen window and its title, with the current one hilighted cyan, followed by the backtick scripts and the data and time.

The final line increases the default number of lines in screen’s scrollback mode (C-a esc).

# Dom's .screenrc
termcapinfo xterm* hs:ts=\E]0;:fs=\007:ds=\E]0;\007

backtick 1 1 0 $HOME/bin/batt_perc.sh
backtick 2 1 0 $HOME/bin/batt_time.sh
backtick 3 1 0 $HOME/bin/temp.sh

hardstatus alwayslastline "%{= G}%-w%{.C}%n %t%{-}%+w %=%{..y} %1` %2` %3` %{..G} %H %{..c} %d/%m/%Y %0c "
defscrollback 1000
# end of file

The three scripts process the yacpi command’s output using awk:

dominic@ubuntu-eee:~ $ cat bin/batt_perc.sh
yacpi -p | awk '{print $4}'
dominic@ubuntu-eee:~ $ cat bin/batt_time.sh
yacpi -p | awk '{print $7}'
dominic@ubuntu-eee:~ $ cat bin/temp.sh
echo "`yacpi -p | awk '{print $16}'`\0260c"

shell

Previous post Next post
Up