streetturtle / awesome-wm-widgets

Widgets for Awesome Window Manager
http://pavelmakhov.com/awesome-wm-widgets/
MIT License
2.16k stars 280 forks source link

brightness_widget: incorrect brightnessctl command for getting current brightness level #399

Closed FerrielMelarpis closed 6 months ago

FerrielMelarpis commented 1 year ago

Hi there, awesomewm beginner here. First of, thanks for this awesome project.

Description

When setting the brightness_widget settings to

brightness_widget({
  type = "icon_and_text",
  program = "brightnessctl",
})

the text displayed is not a percentage value but actual brightness value. In my case it shows 14543 for e.g. and the max brightness value 19393.

Possible solution

To get the actual percentage, I think we can use brightnessctl -m | cut -d, f4 | tr -d %.

Happy to create a PR to fix this and get myself familiar with awesomewm.

jelleh commented 1 year ago

brightnessctl --version

0.5

brightnessctl

Device 'intel_backlight' of class 'backlight': Current brightness: 496 (100%) Max brightness: 496

brightnessctl max

496

brightnessctl get

246

Quick fix

get_brightness_cmd = "bash -c \"brightnessctl -m | awk -F ',' '{print $4+0}'\""

Possible solution I think you have to calculate the percentage with (brightnessctl get/brightnessctl max)x100