Fix battery auto-detect on Linux

This commit is contained in:
2026-06-26 15:55:02 -04:00
parent c313a00d65
commit ad895dfd4f
+5 -3
View File
@@ -3,10 +3,12 @@ _debug "Sourcing tcshrc.system.Linux..."
unsetenv CSHENV_BATTERY_DEVICE unsetenv CSHENV_BATTERY_DEVICE
unsetenv CSHENV_SHOW_BATTERY_LEVEL unsetenv CSHENV_SHOW_BATTERY_LEVEL
set battery_locations=( `ls /sys/class/power_supply/ | grep 'BAT'` ) set battery_locations=( `ls /sys/class/power_supply/ | grep 'BAT[[:digit:]]+$' | xargs` )
if ( $#battery_locations > 0 ) then _debug "Locations: ${battery_locations}"
foreach location ( /sys/class/power_supply/BAT* )
if( ${#battery_locations} > 0 ) then
foreach location ${battery_locations}
setenv CSHENV_BATTERY_DEVICE ${location}/capacity setenv CSHENV_BATTERY_DEVICE ${location}/capacity
setenv CSHENV_SHOW_BATTERY_LEVEL setenv CSHENV_SHOW_BATTERY_LEVEL
end end