polybar / polybar

A fast and easy-to-use status bar
https://polybar.github.io
MIT License
14.07k stars 703 forks source link

module/battery high battery usage #1885

Closed StarrKiss closed 4 years ago

StarrKiss commented 4 years ago

Describe the issue

I am using Polybar on a thinkpad t480, and when I use the battery modules (2, one for the External battery, and one for the internal battery), I get 5-6 watts of battery usage (reported from powertop). However, when these are removed, the battery usage is 4.48. Why?

Expected behavior:

I expect that the battery module does not use up battery life.

Actual behavior:

It uses up considerably more battery

Was it working before? This has been continous as long as I have been using Polybar.

To Reproduce

A minimal but complete config with which the problem occurs:

     modules-right =    volume battery externalbattery network date powermenu

Simply create any config on a laptop with two battery modules.

Polybar Log

Post everything polybar outputs to the terminal when you run it and the issue occurs below

* Loading config: /home/hackerman/.config/polybar/config
- config: Current bar section: [bar/main]
* Loaded monitor eDP1 (1920x1080+0+0)
* Bar geometry: 1920x31+0+1049; Borders: 1,0,0,0
- bar: Attach X event sink
- bar: Attach signal receiver
- controller: Install signal handler
- controller: Setup user-defined modules
* Starting application
- controller: Main thread id = 1
* Starting module/arch
* Starting module/seperator
* Starting module/workspaces
- module/arch: Thread id = 2
* Starting module/google
- module/workspaces: Thread id = 4
- module/seperator: Thread id = 3
* Starting module/github
- module/google: Thread id = 5
* Starting module/reddit
- module/github: Thread id = 6
* Starting module/youtube
- module/reddit: Thread id = 7
* Starting module/dayofweek
- module/youtube: Thread id = 8
* Starting module/volume
- module/dayofweek: Thread id = 9
* Starting module/network
- module/volume: Thread id = 10
* Starting module/date
- module/network: Thread id = 11
* Starting module/powermenu
- module/date: Thread id = 12
- module/powermenu: Thread id = 13
* Entering event loop (thread-id=1)
* Eventqueue worker (thread-id=14)
- bar: Create renderer
- renderer: Get TrueColor visual
- renderer: Allocate colormap
- renderer: Allocate output window
- renderer: Allocate window pixmaps
- renderer: Allocate graphic contexts
- renderer: Allocate alignment blocks
- renderer: Allocate cairo components
- renderer: Load fonts
* Configured DPI = 96x96
* Loaded font "Fantastic Sans Mono:pixelsize=12" (name=Bitstream Vera Sans, offset=3, file=/usr/share/fonts/TTF/Vera.ttf)
* Loaded font "Material Icons:pixelsize=14" (name=Material Icons, offset=3, file=/home/hackerman/.local/share/fonts/Unknown Vendor/TrueType/Material Icons/Material_Icons_Regular.ttf)
* Loaded font "Source Code Pro:pixelsize=12" (name=Source Code Pro, offset=3, file=/usr/share/fonts/adobe-source-code-pro/SourceCodePro-Regular.otf)
* Bar window: 0x3000001
- bar: Reconfigure window
- bar: Set window WM_NAME
- bar: Set window _NET_WM_WINDOW_TYPE
- bar: Set window _NET_WM_STATE
- bar: Set window _NET_WM_DESKTOP
- bar: Set window _NET_WM_PID
- bar: Map window
- bar: Draw empty bar
- bar: Setup tray manager
* Disabling tray manager (reason: missing `tray-position`)
* module/arch: Rebuilding cache
* module/seperator: Rebuilding cache
* module/workspaces: Rebuilding cache
* module/google: Rebuilding cache
* module/github: Rebuilding cache
* module/reddit: Rebuilding cache
* module/youtube: Rebuilding cache
* module/dayofweek: Rebuilding cache
* module/volume: Rebuilding cache
* module/network: Rebuilding cache
* module/date: Rebuilding cache
* module/powermenu: Rebuilding cache
- bar: Force update
* Redrawing bar window
- renderer: flush(1 geom=223x30+0+0, falloff=0)
- renderer: flush(2 geom=111x30+905+0, falloff=0)
- renderer: flush(3 geom=362x30+1558+0, falloff=0)
- bar: Received expose event
* module/network: Rebuilding cache
- bar: Ignoring update (unchanged)
* module/network: Rebuilding cache
- bar: Ignoring update (unchanged)
* module/network: Rebuilding cache
- bar: Ignoring update (unchanged)
* module/network: Rebuilding cache

Environment:

polybar 3.4.0

Features: +alsa +curl +i3 +mpd +network(libnl) +pulseaudio +xkeyboard

X extensions: +randr (+monitors) +composite +xkb +xrm +xcursor

Build type: Release
Compiler: /usr/bin/c++
Compiler flags: -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -Wall -Wextra -Wpedantic -O3 -DNDEBUG
Linker flags: -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now 
patrick96 commented 4 years ago

I'm sorry, I can't reproduce this. I am actually getting lower power consumption with the battery module. I think there are a lot of factors outside of polybar that influence power consumption more than polybar itself.

Is your power consumption consistently over one watt lower without the battery module over multiple tests?

The battery module doesn't actually do that much, so I'm not sure why it would affect battery usage that much. It generally polls the battery between 5 and 1.5 times per second. When polling it reads three files in /sys/class/power_supply. Everything else it does are normal computations. It is possible that reading the files in /sys/class/power_supply may trigger something in the battery but I couldn't imagine what that would be, especially since we are only reading.

patrick96 commented 4 years ago

Closing due to inactivity