Skip to content

Commit

Permalink
Fix displaying 100% battery level
Browse files Browse the repository at this point in the history
  • Loading branch information
aonemd committed Feb 2, 2018
1 parent 3c532ed commit 0e1b759
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/battery_level.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ func main() {
remainingTimePattern, _ := regexp.Compile("[01][0-9]:[0-9][0-9]")

icon := iconPattern.FindString(string(response))
power, _ := strconv.Atoi(powerPattern.FindString(string(response))[:2])
powerString := powerPattern.FindString(string(response))
if last := len(powerString) - 1; last >= 0 && powerString[last] == '%' {
powerString = powerString[:last]
}
power, _ := strconv.Atoi(powerString)
remainingTime := remainingTimePattern.FindString(string(response))

switch icon {
Expand Down

0 comments on commit 0e1b759

Please sign in to comment.