You are not logged in.

#1 2018-11-18 15:13

jschall
Member
Registered: 2018-09-16
Posts: 51

Conky - How to display Pinebook battery?

I'm running TDE on Q4OS on my Pinebook 1080p.

I would like to add a battery monitor to my conky.

I have tried ${battery BAT0} and ${battery BAT1}, but neither produce any display.

What am I missing?

Offline

#2 2018-11-19 11:24

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,992

Re: Conky - How to display Pinebook battery?

Can you check if you have the right info on your system? you could try this command and it should give you the current percentage of your battery

cat /sys/class/power_supply/BAT0/capacity

This should simply output a number between 0 and 100 (the percentage of battery remaining).

If you get a "No such file or directory" error could you post her the output of

ls /sys/class/power_supply/

Offline

#3 2018-11-19 12:58

jschall
Member
Registered: 2018-09-16
Posts: 51

Re: Conky - How to display Pinebook battery?

Thank you for the reply, @Dai_trying.

That command does output the same percent as the little widget on the panel.

I have used it in a script on the top line of my conky:

${exec  /.battery_percent}%

I'd prefer a built-in conky command and a bar graph if possible.

adminq@pinebook1080p:~$ ls /sys/class/power_supply/
ac  battery  usb
adminq@pinebook1080p:~$

Last edited by jschall (2018-11-19 13:12)

Offline

#4 2018-11-19 14:04

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,992

Re: Conky - How to display Pinebook battery?

can you start the conky from the command line using your custom file (if necessary) using ${battery BAT0} so we can see if any error is output

conky -c .my_conkyrc

replacing .my_conkyrc with your custom file (if used)
or if you are using .conkyrc in your home folder simply issuing conky as a command would have the same effect.

please post any output

Offline

#5 2018-11-19 16:44

jschall
Member
Registered: 2018-09-16
Posts: 51

Re: Conky - How to display Pinebook battery?

Do you mean:
------------------------------------------------------------
adminq@pinebook1080p:~$ conky&
[1] 20708
adminq@pinebook1080p:~$ conky: desktop window (1200016) is subwindow of root window (25d)
conky: window type - normal
conky: drawing to created window (0x3800002)
conky: drawing to double buffer
*** Error in `conky': corrupted size vs. prev_size: 0x000000558dafec70 ***
---------------------------------------------------------------------------------------------------------

Offline

#6 2018-11-19 17:57

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,992

Re: Conky - How to display Pinebook battery?

I have requested your wifilevel script in the other post but I think the problem is the same here, comment out the wifilevel script and put ${battery BAT0} in place of your battery level script to see if that works.

Offline

#7 2018-11-19 19:31

jschall
Member
Registered: 2018-09-16
Posts: 51

Re: Conky - How to display Pinebook battery?

Thanks for looking into my problem, @Dai_trying.

Here is what happens when I replace ${exec ./batt_percent} with ${battery BAT0}:

adminq@pinebook1080p:~$ killall conky
adminq@pinebook1080p:~$ conky&
[1] 22726
adminq@pinebook1080p:~$ conky: desktop window (1200016) is subwindow of root window (25d)
conky: window type - normal
conky: drawing to created window (0x3800002)
conky: drawing to double buffer
conky: can't open /sys/class/power_supply/BAT0/uevent: No such file or directory
conky: can't open /proc/acpi/battery/BAT0/state: No such file or directory
conky: can't open /proc/apm: No such file or directory
*** Error in `conky': corrupted size vs. prev_size: 0x000000557271c6d0 ***
^C
[1]+  Aborted                 conky
adminq@pinebook1080p:~$

Offline

#8 2018-11-19 20:04

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,992

Re: Conky - How to display Pinebook battery?

do you get information when using the following command?

cat /sys/class/power_supply/BAT0/uevent

If not could you post the output of

ls -l /sys/class/power_supply/BAT0/

Offline

#9 2018-11-19 21:20

jschall
Member
Registered: 2018-09-16
Posts: 51

Re: Conky - How to display Pinebook battery?

Here ya go:

adminq@pinebook1080p:~$ cat /sys/class/power_supply/BAT0/uevent
cat: /sys/class/power_supply/BAT0/uevent: No such file or directory
adminq@pinebook1080p:~$

adminq@pinebook1080p:~$ ls -l /sys/class/power_supply/BAT0/
ls: cannot access '/sys/class/power_supply/BAT0/': No such file or directory
adminq@pinebook1080p:~$ ^C
adminq@pinebook1080p:~$

I really appreciate your help, @Dai_trying.

Offline

#10 2018-11-19 22:48

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,992

Re: Conky - How to display Pinebook battery?

This doesn't make sense, your reply in post #3 says you issued the command cat /sys/class/power_supply/BAT0/capacity and it produced an output matching your toolbar display but now the same path is not available...???...

it seems you did not execute the command exactly as I posted it but adapted it...

double checking that post you showed the battery listed as battery and not BAT0, maybe you could use ${battery battery} in your conky but I don't know if that will work but it should...

Last edited by Dai_trying (2018-11-19 22:48)

Offline

#11 2018-11-20 02:15

jschall
Member
Registered: 2018-09-16
Posts: 51

Re: Conky - How to display Pinebook battery?

This is the script that works:

#!/bin/sh
cat /sys/class/power_supply/battery/capacity

So, it seems that "battery" has replaced "BAT0" everywhere?

Offline

#12 2018-11-20 10:19

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,992

Re: Conky - How to display Pinebook battery?

yes it looks that way, did you try it in conky? and did it work?

Offline

#13 2018-11-20 13:20

jschall
Member
Registered: 2018-09-16
Posts: 51

Re: Conky - How to display Pinebook battery?

Well, ${battery battery} sort of works. It gives a weird negative percent.

But my conky still keeps crashing, as you can see in the screenshot.


Attachments:
png battery_battery.png, Size: 265.05 KiB, Downloads: 560

Offline

#14 2018-11-20 14:30

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,992

Re: Conky - How to display Pinebook battery?

This is definitely a bit weird... unfortunately I do not have any similar hardware to be able to test so not sure I can offer any more advice really...

One thing you could try is to comment out all lines in the text section and then un-comment 1 line at a time to see where the problem starts, this is what I would do to narrow down where any problem(s) is (are).

Offline

#15 2018-11-25 22:35

jschall
Member
Registered: 2018-09-16
Posts: 51

Re: Conky - How to display Pinebook battery?

I finally have a workaround that displays the battery percentage and status in Conkyon my Pinebook.

I use the shell commands in script files:

#!/bin/sh
cat /sys/class/power_supply/battery/capacity

and

#!/bin/sh
cat /sys/class/power_supply/battery/status

and I just use two ${exec ./ } commands on a line in .conkyrc

It may not be elegant, but it works.

Offline

Board footer

Powered by FluxBB