Battery control not an env-var
This commit is contained in:
+3
-3
@@ -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}
|
||||
|
||||
+4
-4
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user