-# are marked as "(BATTERY)".
-if test ! -d /sys/class/power_supply/BAT0; then
- echo screenrc: removing battery display
- grep -v '(BATTERY)' screenrc > screenrc.tmp
- mv screenrc.tmp screenrc
+# are marked as "(BATTERY)". Also used for Tmux.
+battery=
+for x in /sys/class/power_supply/BAT*; do
+ test -d "$x" || continue
+ battery="$x"
+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=