polybar / polybar/polybar-scripts

battery-combined-udev 34: arithmetic expression: expecting primary: ""31800000 + 0""

Open
#446 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
2.6k
Forks
331
PR merge metrics
No merged PRs in 30d

Description

When I try to use battery-combined-udev it gives me this error: 34: arithmetic expression: expecting primary: ""31800000 + 0""

A similar error happens the following lines:

    battery_level=$(("$battery_level_0 + $battery_level_1"))
    battery_max=$(("$battery_max_0 + $battery_max_1"))

    battery_percent=$(("$battery_level * 100"))
    battery_percent=$(("$battery_percent / $battery_max"))

After changing it to the following, the problem was fixed

    battery_level=$(($battery_level_0 + $battery_level_1))
    battery_max=$(($battery_max_0 + $battery_max_1))

    battery_percent=$(($battery_level * 100))
    battery_percent=$(($battery_percent / $battery_max))

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open the battery-combined-udev script and reproduce the arithmetic error with the battery setup described in the issue. Inspect the four arithmetic expressions shown in the report, then verify that the script calculates the combined level, maximum and percentage without the reported shell error.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
operating-systems
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.