polybar: brightness
This commit is contained in:
parent
a9c5fd1c6d
commit
70fcf716f9
2 changed files with 5 additions and 62 deletions
|
@ -4,29 +4,6 @@
|
||||||
# Make sure you have inotify-tools (and brightnessctl obv) installed otherwise inotifywait won't work
|
# 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
|
# 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
|
# 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(){
|
increase(){
|
||||||
brightnessctl s +2% > /dev/null
|
brightnessctl s +2% > /dev/null
|
||||||
return
|
return
|
||||||
|
@ -47,8 +24,4 @@ case "$1" in
|
||||||
decrease
|
decrease
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
*)
|
|
||||||
brightnessctl g |
|
|
||||||
echo "$(getIcon) $brightness_percent%"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -66,46 +66,16 @@ click-left = /home/mg/dotfiles/polybar/popup-calendar.sh --popup &
|
||||||
[module/system-cpu-loadavg]
|
[module/system-cpu-loadavg]
|
||||||
type = custom/script
|
type = custom/script
|
||||||
exec = /home/mg/dotfiles/polybar/system-cpu-loadavg.sh
|
exec = /home/mg/dotfiles/polybar/system-cpu-loadavg.sh
|
||||||
interval = 5
|
interval = 10
|
||||||
|
format-prefix = "LAVG "
|
||||||
|
|
||||||
[module/backlight]
|
[module/backlight]
|
||||||
type = custom/script
|
type = custom/script
|
||||||
exec=/home/mg/dotfiles/polybar/backlight.sh
|
exec = /usr/bin/brightnessctl g
|
||||||
tail=true
|
tail = true
|
||||||
interval=0
|
interval = 5
|
||||||
scroll-up = /home/mg/dotfiles/polybar/backlight.sh increase
|
scroll-up = /home/mg/dotfiles/polybar/backlight.sh increase
|
||||||
scroll-down = /home/mg/dotfiles/polybar/backlight.sh decrease
|
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]
|
[module/i3]
|
||||||
type = internal/i3
|
type = internal/i3
|
||||||
|
|
Loading…
Reference in a new issue