diff --git a/polybar/backlight.sh b/polybar/backlight.sh index 004fbc5..f6c0083 100755 --- a/polybar/backlight.sh +++ b/polybar/backlight.sh @@ -4,29 +4,6 @@ # Make sure you have inotify-tools (and brightnessctl obv) installed otherwise inotifywait won't work # You need to install a font from nerdfonts.com in order to see glyphs correctly. You can replace them with what you prefer # https://raw.githubusercontent.com/FedericoAntoniazzi/dotfiles/master/.config/polybar/backlight.sh -brightness_level=$(brightnessctl g) -brightness_max=$(brightnessctl m) -brightness_percent=$(( $brightness_level * 100 / $brightness_max )) - -getIcon() { - if [ "$brightness_percent" -ge 90 ]; then - icon="" - elif [ "$brightness_percent" -ge 75 ]; then - icon="" - elif [ "$brightness_percent" -ge 50 ]; then - icon="" - elif [ "$brightness_percent" -ge 40 ]; then - icon="" - elif [ "$brightness_percent" -ge 25 ]; then - icon="" - elif [ "$brightness_percent" -ge 10 ]; then - icon="" - else - icon="" - fi - echo "$icon" -} - increase(){ brightnessctl s +2% > /dev/null return @@ -47,8 +24,4 @@ case "$1" in decrease exit ;; - *) - brightnessctl g | - echo "$(getIcon) $brightness_percent%" - ;; esac diff --git a/polybar/config b/polybar/config index 6ac1ffe..286edae 100644 --- a/polybar/config +++ b/polybar/config @@ -66,46 +66,16 @@ click-left = /home/mg/dotfiles/polybar/popup-calendar.sh --popup & [module/system-cpu-loadavg] type = custom/script exec = /home/mg/dotfiles/polybar/system-cpu-loadavg.sh -interval = 5 +interval = 10 +format-prefix = "LAVG " [module/backlight] type = custom/script -exec=/home/mg/dotfiles/polybar/backlight.sh -tail=true -interval=0 +exec = /usr/bin/brightnessctl g +tail = true +interval = 5 scroll-up = /home/mg/dotfiles/polybar/backlight.sh increase scroll-down = /home/mg/dotfiles/polybar/backlight.sh decrease -format-background = ${color.shade5} -format-foreground = ${color.modulefg} -format-padding = 1 - -[module/xwindow] -type = internal/xwindow -label = %title:0:30:...% - -;[module/backlight] -;type = internal/backlight -; Use the following command to list available cards: -; $ ls -1 /sys/class/backlight/ -;card = amdgpu_bl0 -; -; (unreleased) -; Use the `/sys/class/backlight/actual-brightness` file -; rather than the regular `brightness` file. -; Defaults to true unless the specified card is an amdgpu backlight. -; use-actual-brightness = true -; -; Enable changing the backlight with the scroll wheel -; NOTE: This may require additional configuration on some systems. Polybar will -; write to `/sys/class/backlight/${self.card}/brightness` which requires polybar -; to have write access to that file. -; DO NOT RUN POLYBAR AS ROOT. -; The recommended way is to add the user to the -; `video` group and give that group write-privileges for the `brightness` file. -; See the ArchWiki for more information: -; https://wiki.archlinux.org/index.php/Backlight#ACPI -; Default: false -enable-scroll = true [module/i3] type = internal/i3