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

Battery not showing in staus bar (solved) #66

Closed
ralphee opened this issue Dec 13, 2016 · 12 comments
Closed

Battery not showing in staus bar (solved) #66

ralphee opened this issue Dec 13, 2016 · 12 comments

Comments

@ralphee
Copy link

ralphee commented Dec 13, 2016

so i copied the battery folder into:
~/.i3/blocks/battery

in my i3blocks.conf i added:
[battery]
command=$SCRIPT_DIR/battery.py
markup=pango
interval=30

was not 100% sure so i also played with command syntax:
command=~/.i3/blocks/battery/battery.py

unfortunately the only thing that shows in my status bar is the label.

would be most grateful if someone could point me in the right direction. Thxs!

all dependencies are installed

@kb100
Copy link
Collaborator

kb100 commented Dec 15, 2016

Can you post the output of running ~/.i3/blocks/battery/battery.py from the command line?

@kb100
Copy link
Collaborator

kb100 commented Dec 15, 2016

And also the output of acpi please.

@ralphee
Copy link
Author

ralphee commented Dec 16, 2016

this is what i get:

http://ix.io/1MBL
http://ix.io/1MGb

@kb100
Copy link
Collaborator

kb100 commented Dec 17, 2016

@ralpheeee88 Very interesting (confusing). The only code path that leads to the output you posted is the following:

from subprocess import check_output
status = check_output(['acpi'], universal_newlines=True)
if not status:
    # stands for no battery found
    fulltext = "<span color='red'><span font='FontAwesome'>\uf00d \uf240</span></span>"

This only happens when everything runs successfully but acpi returns no output. This is standard behavior only if you have no battery. However, the acpi output you posted clearly is not empty, so the script should not have entered this code path.

The following troubleshooting ideas come to mind:

Try running python3 and interactively typing the two lines:

from subprocess import check_output
check_output(['acpi'], universal_newlines=True)

Is the output empty, or does it show something like "Battery 0: Discharging, 100%, 07:15:46 remaining"? Repeat process many times to ensure behavior is consistent.

Try running acpi many times from the command line, does it always produce good output, or does it sometimes produce empty output or an error?

Are you running an experimental version of python or acpi?

@ralphee
Copy link
Author

ralphee commented Dec 18, 2016

https://i.imgur.com/ZbVs7op.png
https://i.imgur.com/Lu2XhNM.png

'acpi' always produces results......am stumped on this one...

@kb100
Copy link
Collaborator

kb100 commented Dec 19, 2016

Alright my ideas are increasingly far-fetched but let's give it a go.

Run sha256sum battery.py and check that you get

78f7381d558141ee2cead04ef66d58928527cde9a3050ce74289ae3e8c92a395  battery.py

I see you are using some fancy shell/terminal. Can you try using a different shells and terminals? E.g.

bash
./battery.py

Also, if you can manage, try running a live operating system (e.g. debian live) from a usb stick and run the script from that environment.

Finally, you can try cloning https://github.com/kb100/i3blocks-battery, the repo that used to be for the battery blockelt, and see if you can find any commit where the script works. You may want to use git bisect to ease finding what may be the offending commit.

@ralphee
Copy link
Author

ralphee commented Jan 5, 2017

forgive my noobness pls....have a thinkpad (p50) and installed tlp.....while going through the conf file I saw that there is BAT0 and BAT1 ...with the script is the default BAT0....could this be possibly the course of my error

@kb100
Copy link
Collaborator

kb100 commented Jan 6, 2017

This script does not default to BAT0, it (should) handle the case of multiple batteries. Have you confused this repo's battery script https://github.com/vivien/i3blocks-contrib/blob/master/battery/battery.py with the official battery script https://github.com/vivien/i3blocks/blob/master/scripts/battery in the i3blocks repo?

That script does default to BAT0.

@ralphee
Copy link
Author

ralphee commented Jan 6, 2017

Kb100... Thxs for feedback.... I double checked I have the correct script....

@kb100
Copy link
Collaborator

kb100 commented Jan 6, 2017

Can you follow the steps I asked from 2 posts ago with sha256sum and using different shells. Your output is not consistent with running the current version of the script.

@ralphee
Copy link
Author

ralphee commented Jan 10, 2017

i dont know....i got the battery in my status bar but i think its a rather messy work around ...i dont know...

i3blocks config
https://i.imgur.com/rlQb7YM.png
https://i.imgur.com/nh1lx0q.png

using this script:
https://github.com/Anachron/i3blocks/blob/master/blocks/battery

in conjunction with your srcipt (made sure i also installed all the dependencies font-awesome ...my python version 3.6.0) produces the following result:
https://i.imgur.com/3noLbhQ.png

I am hoping the info can shed some light/clarity on whats going on...obviously i would prefer to use your script with the icons on its own....

UPDATE
icons are working now
https://i.imgur.com/8RpqLUB.png

just going through the steps you kindly asked me to follow (sorry didnt see it)
checksum: https://i.imgur.com/5DGgKRC.png
current shell: vanilla zsh
terminal: termite

with bash:
https://i.imgur.com/Lvh18Oa.png

@kb100
Copy link
Collaborator

kb100 commented Jan 13, 2017

Ok I'm confused, before when you ran ./battery.py you got no output, but now the output you posted is correct. What changed? The block is not supposed to have a fixed label. The lightning label indicates charging, the plug label indicates that the device is plugged in, the battery label indicates that the device is on battery (i.e. not plugged in).

@ralphee ralphee changed the title Battery not showing in staus bar Battery not showing in staus bar (solved) Oct 5, 2017
@kb100 kb100 closed this as completed Nov 27, 2017
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

No branches or pull requests

2 participants