Skip to content

Enhancement: Regarding Support Multiple Types of Batteries #244

@dev-onejun

Description

@dev-onejun

Describe the feature you'd like

Since (it seems that) there are a few types of laptop batteries not supported by the current battery.sh script,
I would like to add a feature to enable dracula/tmux to get a piece of information without neither upower or acpi which requires an additional installation.

Describe risks you've considered

.

Describe alternatives you've considered

.

Descriptions

Thank you for maintaining this wonderful tmux theme.

I recently joined the tmux and used the dracula theme.

However, I encountered an issue that the battery info was not presented while I configured the theme on my laptop.

Here are my device details:

$ uname -a
Linux XXX 6.2.0-39-generic #40~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 16 10:53:04 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

$ ls /sys/class/power_supply
ADP1  CMB0  ucsi-source-psy-USBC000:001

$ upower -e
/org/freedesktop/UPower/devices/line_power_ADP1
/org/freedesktop/UPower/devices/battery_CMB0
/org/freedesktop/UPower/devices/line_power_ucsi_source_psy_USBC000o001
/org/freedesktop/UPower/devices/DisplayDevice

The laptop manufacturer was LG, and CMB0 included the status and capacity of the battery.

Solutions

I think that the files, status and capacity, are the only unique files in the system showing information about the battery.

So, I edited line 10, which selected the battery device in the battery.sh script.

1

BAT=$(ls -d /sys/class/power_supply/*CMB* | head -1)

2

BAT=$(ls -d /sys/class/power_supply/*)

Both of them worked on my laptop.

In order to support the previous BAT, I chose the second solution. (#245)

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions