5 Commits
v1.0.0 ... main

Author SHA1 Message Date
Pim
7366f373e0 Update README.md 2021-12-09 05:28:25 +00:00
999954766e Added adaptive icon, changing based on the brightness value. Increased default interval. Updated README. 2021-12-05 09:28:54 +01:00
cb9dd4a07c Update README.md 2021-10-09 13:39:41 +00:00
04ba653e85 Update README.md 2021-10-09 13:39:07 +00:00
6b30226041 Update README.md 2021-10-09 13:38:52 +00:00
3 changed files with 45 additions and 6 deletions

View File

@ -1,2 +1,29 @@
# brightnessctl-polybar ### brightnessctl polybar module
Polybar module and custom script for brightnessctl package. Polybar module using a custom script for adjusting screen brightness using the brightnessctl package.
The brightnessctl package is the only one that managed to change the brightness of my laptop screen. Other packages failed to work. Therefore, I wrote this script and module to be able to adjust screen brightness using brightnessctl from polybar. It is adjusted by scrolling up and down on the module.
### Installation
1. Download the files as a ZIP or clone into a temporary directory.
2. Move `brightnessctl.sh` to `~/.config/polybar/` folder.
3. Make `brightnessctl.sh` executable by executing `chmod +x ~/.config/polybar/brightnessctl.sh`.
4. Decide where you will put the module. Depending on your choice, add `brightnessctl` to the `modules-left`,`modules-center` or `modules-right` variable in your polybar config file.
5. Add the following lines to the `~/.config/polybar/config` file:
```
[module/brightnessctl]
type = custom/script
exec = ~/.config/polybar/brightnessctl.sh
scroll-up = exec brightnessctl set +5%
scroll-down = exec brightnessctl set 5%-
interval = 0.5
label = %output%
label-foreground = ${colors.foreground}
```
6. Adjust the `interval` and `label-foreground` values to your liking.
### Note
- This module uses custom icons from the `MaterialIcons` font package by Google. If you do not have this you may install it (it's most likely in your repository), or choose your own gliph, simply replace the characters that are assigned in the shell script.

View File

@ -1,3 +1,16 @@
#!/bin/bash #!/bin/bash
echo "$(brightnessctl | grep -o "(.*" | tr -d "()")" BRIGHTNESS_VALUE=`brightnessctl | grep -o "(.*" | tr -d "()"`
BRIGHTNESS_NR=${BRIGHTNESS_VALUE//%}
if [ $BRIGHTNESS_NR -lt 20 ]; then
BRIGHTNESS_ICON=''
elif [ $BRIGHTNESS_NR -lt 50 ]; then
BRIGHTNESS_ICON=''
elif [ $BRIGHTNESS_NR -lt 80 ]; then
BRIGHTNESS_ICON=''
else
BRIGHTNESS_ICON=''
fi
echo "$BRIGHTNESS_ICON $BRIGHTNESS_VALUE"

View File

@ -15,8 +15,7 @@ exec = ~/.config/polybar/brightnessctl.sh
scroll-up = exec brightnessctl set +5% scroll-up = exec brightnessctl set +5%
scroll-down = exec brightnessctl set 5%- scroll-down = exec brightnessctl set 5%-
interval = 0.2 interval = 0.5
format-prefix = " "
label = %output% label = %output%
label-foreground = #FFFFFF label-foreground = ${colors.foreground}