I recently noticed that the remaining battery time stopped showing on my laptop. I started digging into it and found these lines to be problematic:
https://github.com/tmux-plugins/tmux-battery/blob/master/scripts/battery_remain.sh#L118-L123
for whatever reason, my laptop natively running Linux snejugal 7.0.3 #1-NixOS SMP PREEMPT_DYNAMIC Thu Apr 30 09:13:05 UTC 2026 x86_64 GNU/Linux is detected as WSL by is_wsl (changed in #119). then the scripts starts looking for charge_full, charge_now, current_now in /sys/class/power-supply but can't find any. that's because these are actually (I guess) energy_full, energy_now and voltage_now on my machine:
$ ls /sys/class/power_supply/BAT0
alarm charge_control_end_threshold energy_full extensions model_name present subsystem uevent
capacity cycle_count energy_full_design hwmon3 power serial_number technology voltage_min_design
capacity_level device energy_now manufacturer power_now status type voltage_now
I guess this might have changed in recent Linux versions or depends on the driver.
print_battery_remain also supports upower and that works just fine, but my natively running Linux is detected as WSL, so that branch can never be reached. so I see a few problems here:
- the code gated behind
is_wsl supposedly became outdated;
- this manual work with
/sys interfaces is the primary way to calculate remaining time, not a fallback in case other tools are not available;
- one can't choose the backend to use.
I recently noticed that the remaining battery time stopped showing on my laptop. I started digging into it and found these lines to be problematic:
https://github.com/tmux-plugins/tmux-battery/blob/master/scripts/battery_remain.sh#L118-L123
for whatever reason, my laptop natively running
Linux snejugal 7.0.3 #1-NixOS SMP PREEMPT_DYNAMIC Thu Apr 30 09:13:05 UTC 2026 x86_64 GNU/Linuxis detected as WSL byis_wsl(changed in #119). then the scripts starts looking forcharge_full,charge_now,current_nowin/sys/class/power-supplybut can't find any. that's because these are actually (I guess)energy_full,energy_nowandvoltage_nowon my machine:I guess this might have changed in recent Linux versions or depends on the driver.
print_battery_remainalso supportsupowerand that works just fine, but my natively running Linux is detected as WSL, so that branch can never be reached. so I see a few problems here:is_wslsupposedly became outdated;/sysinterfaces is the primary way to calculate remaining time, not a fallback in case other tools are not available;