Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion scripts/battery_remain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ acpi_battery_remaining_time() {

print_battery_remain() {
if is_wsl; then
echo "?" # currently unsupported on WSL
local charge_full charge_now current_now
charge_full=$(find /sys/class/power_supply/*/charge_full | tail -n1 | xargs cat)
charge_now=$(find /sys/class/power_supply/*/charge_now | tail -n1 | xargs cat)
current_now=$(find /sys/class/power_supply/*/current_now | tail -n1 | xargs cat)
echo $charge_full $charge_now $current_now | awk '{num=($1-$2)/$3; printf "%02d:%02d:%02d", int(num), int(60*num%60), int(3600*num%60)}'
elif command_exists "pmset"; then
pmset_battery_remaining_time
elif command_exists "acpi"; then
Expand Down
2 changes: 1 addition & 1 deletion scripts/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ is_chrome() {

is_wsl() {
version=$(</proc/version)
if [[ "$version" == *"Microsoft"* || "$version" == *"microsoft"* ]]; then
if [[ "$version" == *"Linux"* || "$version" == *"Microsoft"* || "$version" == *"microsoft"* ]]; then
return 0
else
return 1
Expand Down