Battery control not an env-var

This commit is contained in:
2026-06-28 01:38:53 -04:00
parent a7d9745e41
commit 79d6e087ce
2 changed files with 7 additions and 7 deletions
+3 -3
View File
@@ -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="%{${csi}0;48\;5\;7m%}(${prompt_reference_core}%{${csi}0;48\;5\;7m%})%{${dim}%}"
#set prompt_reference="${prompt_reference_core}%{${text_color_seq}%} \- " #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 if( $CSHENV_SYSTEM == "Darwin" ) then
set battery_level=`pmset -g batt | grep -Eo "\d+%" | cut -d% -f1` set battery_level=`pmset -g batt | grep -Eo "\d+%" | cut -d% -f1`
else if( $?CSHENV_BATTERY_DEVICE ) then else if( $?cshenv_battery_device ) then
set battery_level=`cat ${CSHENV_BATTERY_DEVICE}` set battery_level=`cat ${cshenv_battery_device}`
endif endif
if( ${battery_level} < ${critical_battery_level} ) then if( ${battery_level} < ${critical_battery_level} ) then
set battery_color=${red}${blink} set battery_color=${red}${blink}
+4 -4
View File
@@ -1,7 +1,7 @@
_debug "Sourcing tcshrc.system.Linux..." _debug "Sourcing tcshrc.system.Linux..."
unsetenv CSHENV_BATTERY_DEVICE unset cshenv_battery_device
unsetenv CSHENV_SHOW_BATTERY_LEVEL unset cshenv_show_battery_level
set battery_locations=`ls /sys/class/power_supply/ | grep 'BAT[[:digit:]]\+$' | xargs` 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 if( ${#battery_locations} > 0 ) then
foreach location ( ${battery_locations} ) foreach location ( ${battery_locations} )
setenv CSHENV_BATTERY_DEVICE /sys/class/power_supply/${location}/capacity set cshenv_battery_device="/sys/class/power_supply/${location}/capacity"
setenv CSHENV_SHOW_BATTERY_LEVEL set cshenv_show_battery_level
end end
endif endif