Proposal of a temporary fix for sway battery information on pinebook pro

Hello Everyone,

I’ve fallen in love with the sway version of Manjaro for the Pinebook Pro.
Like other pinebook users after the update, my Battery indicator for the waybar was broken:
Manjaro Forum ticket
Github complaint

Expand to see my more or less functional fix

edit ~/.config/waybar/config with your preferred text editor
comment out the following line:
line 32: "battery",line 32: //"battery",
append the following line:
line 33: "custom/battery",
add the following block to line 62:

    "custom/battery":{
        "interval": 10,
        "states": {
            "warning": 30,
            "critical": 15
        },
        "format": " {}% ",
        "tooltip": false,
        "exec": "cat /sys/class/power_supply/cw2015-battery/capacity",
    },

this fix will

  • show the correct battery percentage
  • show a battery icon

it will not

  • change the appearance of the icon when the battery depletes
  • show whether the battery is charging, though I could work on a solution to that

what do you think? In my humble opinion, this is still better than not having any batery information at all. Since I don’t see the problem getting resolved upstream, this or a modified version of the script could be included in the next Manjaro pbpro arm release.

Best Regards, Julius

1 Like

Thanks for the proposal… nice approach and eventually can be extended to also support different icon styles and tooltip text easily, but will only work with the Pinebook Pro then (as for other devices the battery identifier will be different)… so ppl. may have to adapt the waybar config to their device after initial installation…

The Charge Now support will be part of upstream 5.13 kernel.

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/power/supply/cw2015_battery.c?h=next-20210325&id=bf3841073bf34c9568ee5d6a6020b3902b3eef81

1 Like

Just did a temporary fix for Pinebook and Pinebook Pro users… be aware you have to select the proper battery widget from the Waybar config from next release…

2 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.