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 Charge display not working #16

Closed
mztikk opened this issue Oct 27, 2021 · 5 comments · Fixed by #23
Closed

Battery Charge display not working #16

mztikk opened this issue Oct 27, 2021 · 5 comments · Fixed by #23

Comments

@mztikk
Copy link

mztikk commented Oct 27, 2021

Battery Charge is not being displayed in status bar, running the battery.sh also gives following errors

Use of uninitialized value $bat_state in pattern match (m//) at .config/i3/scripts/battery.sh line 46.
Use of uninitialized value $bat_state in concatenation (.) or string at .config/i3/scripts/battery.sh line 47.

After switching back to this version https://github.com/endeavouros-team/endeavouros-i3wm-setup/blob/3c7ced74922a4116bbec21a44d20687c0abefdb3/.config/i3/scripts/battery.sh it works again

@killajoe
Copy link
Member

Thanks for heads-up.. i will check this asap, the changes were committed by @alindl
Let`s see

@k2s
Copy link
Contributor

k2s commented Nov 18, 2021

@mztikk I created pull request. Could you please confirm, that upower -i /org/freedesktop/UPower/devices/battery_BAT0 returns no data on your PC? Also probably you are using variable env BLOCK_INSTANCE to set value and you get information for other battery then 0.

@HarshalRathore
Copy link
Contributor

Hii @killajoe
I am having the same problem. I tried finding solution for this on internet but as I don't have much shell scripting knowledge I couldn't find anything relevant to it. Is there any update on this issue.

@HarshalRathore
Copy link
Contributor

HarshalRathore commented Nov 19, 2021

Hello @k2s
I tried your script but it is still not working for me.

output of shellscript

Use of uninitialized value $bat_state in pattern match (m//) at .config/i3/scripts/battery.sh line 53.
Use of uninitialized value $bat_state in concatenation (.) or string at .config/i3/scripts/battery.sh line 54.

I also ran the upower -i /org/freedesktop/UPower/devices/battery_BAT0 command on my PC it gave this output.

  native-path:          (null)
  power supply:         no
  updated:              Thursday 01 January 1970 05:30:00 AM (1637303381 seconds ago)
  has history:          no
  has statistics:       no
  unknown
    warning-level:       unknown
    battery-level:       unknown
    percentage:          0% (should be ignored)
    icon-name:          '(null)'

killajoe added a commit that referenced this issue Nov 20, 2021
fix Battery Charge display not working (#16)
@k2s
Copy link
Contributor

k2s commented Nov 20, 2021

@HarshalRathore

  • make sure you have upower installed
    • the original code, which works for you, was using acpi for the new one requires upowe
  • if some other battery number (see ?) works in upower -i /org/freedesktop/UPower/devices/battery_BAT? then it is possible to set this number by adding BLOCK_INSTANCE=? to your i3blocks.conf

@k2s k2s mentioned this issue Nov 20, 2021
@killajoe killajoe unpinned this issue May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

4 participants