Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended Support for Battery Detection and Display on WSL #108

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

thekpaul
Copy link

(I'm back earlier than expected - check out #107 for an earlier version of this PR)

  1. Adds a percentage symbol at the end of battery percentage when used in a WSL environment with battery
  2. Resolves a problem on WSL desktop environments where there was no battery:
    a. Check existence of battery-related directories or files whenever needed (percentage, icon_status and icon_charge)
    b. Default behaviour to "Charging" for Status, "Tier 8 (Fully Charged)" for Charge and null for Percentage (Not printed)

I've only made changes for percentage and icon display, so we may need to make more commits before everything else work seamlessly as well. In the meantime, I'd say that this is a minimal working PR for WSL environments both with and without batteries.

Instead of straightforwardly calling `cat`, I've encased the command in
`echo` to enable appending strings. This allows me to add a percentage
symbol after calling `cat "$battery"`!

This also suppresses any `echo`s for machines without battery
(i.e. a desktop environment)
This ensures that the script does not return errors when operating in
environments without batteries, as if there are no battery-related files
in the target directory, the script now stops from accessing the files
to begin with.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant