From 79d6e087cee147da6cca315cdedbfd2d2f9dc5fb Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Sun, 28 Jun 2026 01:38:53 -0400 Subject: [PATCH] Battery control not an env-var --- tcshrc.prompt.final | 6 +++--- tcshrc.system.Linux | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tcshrc.prompt.final b/tcshrc.prompt.final index 4638e07..c35ab51 100644 --- a/tcshrc.prompt.final +++ b/tcshrc.prompt.final @@ -122,11 +122,11 @@ set prompt_reference="%{${dim}%}< ${prompt_reference_core} %{${dim}%}> " #set prompt_reference="%{${csi}0;48\;5\;7m%}(${prompt_reference_core}%{${csi}0;48\;5\;7m%})%{${dim}%}" #set prompt_reference="${prompt_reference_core}%{${text_color_seq}%} \- " -if( $?CSHENV_SHOW_BATTERY_LEVEL ) then +if( $?cshenv_show_battery_level ) then if( $CSHENV_SYSTEM == "Darwin" ) then set battery_level=`pmset -g batt | grep -Eo "\d+%" | cut -d% -f1` - else if( $?CSHENV_BATTERY_DEVICE ) then - set battery_level=`cat ${CSHENV_BATTERY_DEVICE}` + else if( $?cshenv_battery_device ) then + set battery_level=`cat ${cshenv_battery_device}` endif if( ${battery_level} < ${critical_battery_level} ) then set battery_color=${red}${blink} diff --git a/tcshrc.system.Linux b/tcshrc.system.Linux index 4d1ed6c..536915d 100644 --- a/tcshrc.system.Linux +++ b/tcshrc.system.Linux @@ -1,7 +1,7 @@ _debug "Sourcing tcshrc.system.Linux..." -unsetenv CSHENV_BATTERY_DEVICE -unsetenv CSHENV_SHOW_BATTERY_LEVEL +unset cshenv_battery_device +unset cshenv_show_battery_level set battery_locations=`ls /sys/class/power_supply/ | grep 'BAT[[:digit:]]\+$' | xargs` @@ -9,8 +9,8 @@ _debug "Locations: ${battery_locations}" if( ${#battery_locations} > 0 ) then foreach location ( ${battery_locations} ) - setenv CSHENV_BATTERY_DEVICE /sys/class/power_supply/${location}/capacity - setenv CSHENV_SHOW_BATTERY_LEVEL + set cshenv_battery_device="/sys/class/power_supply/${location}/capacity" + set cshenv_show_battery_level end endif