Giter Site home page Giter Site logo

Comments (12)

kb100 avatar kb100 commented on August 20, 2024 1

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

from i3blocks-contrib.

kb100 avatar kb100 commented on August 20, 2024

And also the output of acpi please.

from i3blocks-contrib.

ralphee avatar ralphee commented on August 20, 2024

this is what i get:

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

from i3blocks-contrib.

kb100 avatar kb100 commented on August 20, 2024

@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?

from i3blocks-contrib.

ralphee avatar ralphee commented on August 20, 2024

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

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

from i3blocks-contrib.

kb100 avatar kb100 commented on August 20, 2024

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.

from i3blocks-contrib.

ralphee avatar ralphee commented on August 20, 2024

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

from i3blocks-contrib.

kb100 avatar kb100 commented on August 20, 2024

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.

from i3blocks-contrib.

ralphee avatar ralphee commented on August 20, 2024

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

from i3blocks-contrib.

kb100 avatar kb100 commented on August 20, 2024

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.

from i3blocks-contrib.

ralphee avatar ralphee commented on August 20, 2024

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

from i3blocks-contrib.

kb100 avatar kb100 commented on August 20, 2024

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).

from i3blocks-contrib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.