From: Simon Ruderich Date: Thu, 24 Oct 2013 00:27:20 +0000 (+0200) Subject: screenrc,tmux.conf: Display CPU temperature. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=ba1e10becaa8755981364ea61deee6cf48c38fb9;p=config%2Fdotfiles.git screenrc,tmux.conf: Display CPU temperature. --- diff --git a/screenrc.in b/screenrc.in index e79065e..4d292d0 100644 --- a/screenrc.in +++ b/screenrc.in @@ -67,6 +67,8 @@ sorendition = Bw # Display current battery charge if running on a laptop. Redisplay every 3 # minutes. backtick 1 180 180 $HOME/.shell/bin/battery.pl -s BATTERY # (BATTERY) +# Display current temperature if running on a laptop. Redisplay every minute. +backtick 2 60 60 $HOME/.shell/bin/temperature.pl -s TEMPERATURE # (TEMPERATURE) # Make sure the temporary variable we use is empty. Thanks to # http://gist.github.com/133000 for the idea to use setenv and to TauPan in @@ -92,6 +94,8 @@ setenv s "$s%=" # - right align the following text setenv s "$s%l" # - load average setenv s "$s " # - space setenv s "$s%H" # - hostname +setenv s "$s " # - space (TEMPERATURE) +setenv s "$s%2`" # - temperature (TEMPERATURE) setenv s "$s " # - space (BATTERY) setenv s "$s%1`" # - battery status (BATTERY) hardstatus alwayslastline "$s" diff --git a/setup.sh b/setup.sh index 3edf5f4..197263d 100755 --- a/setup.sh +++ b/setup.sh @@ -195,6 +195,14 @@ for x in /sys/class/power_supply/BAT*; do done apply_optional_replacement screenrc \ battery BATTERY "$battery" +# Display current temperature. Necessary lines are marked as "(TEMPERATURE)". +# Also used for Tmux. +temperature=/sys/devices/platform/coretemp.0 +if ! test -d "$temperature"; then + temperature= +fi +apply_optional_replacement screenrc \ + temperature TEMPERATURE "$temperature" if installed tmux; then @@ -202,6 +210,8 @@ if installed tmux; then apply_optional_replacement tmux.conf \ battery BATTERY "$battery" + apply_optional_replacement tmux.conf \ + temperature TEMPERATURE "$temperature" # Old Tmux versions can't handle that. generate tmux.conf '' ./bin/remove-continuation.pl diff --git a/tmux.conf.in b/tmux.conf.in index ea82d37..699458a 100644 --- a/tmux.conf.in +++ b/tmux.conf.in @@ -68,6 +68,7 @@ set-option -g status-left "" # Current load average and hostname (#H) on the right. set-option -g status-right "#(uptime | sed 's/^.*load averages*: //; s/,//g') \ #H \ + #(~/.shell/bin/temperature.pl -t TEMPERATURE)\ #[] #(~/.shell/bin/battery.pl -t BATTERY)\ "