Files
dotfiles/brightness/.scripts/brightness.sh
Sravan Balaji e596ff1788 swhkd Configuration
- Add swhkd configuration
- Use brightnessctl for brightness control
- Update dwl, doom-emacs, dracula-gtk, and tmux submodules
2024-09-28 16:03:19 -04:00

53 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
help_menu() {
echo "Script to control brightness. Use only one argument at a time."
# echo " - Play / Pause: playerctl.sh --play-pause"
# echo " - Next: playerctl.sh --next"
# echo " - Previous: playerctl.sh --prev"
# echo " - Change Player: playerctl.sh --change"
# echo " - Rofi Menu: playerctl.sh --rofi"
# echo " - Help: playerctl.sh --help OR playerctl.sh -h"
}
rofi_menu() {
declare -a options=(
"󰃠 Raise Brightness - raise"
"󰃞 Lower Brightness - lower"
"󰌍 Back - back"
"󰗼 Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" == "quit" ]]; then
pkill rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}
main() {
if [ $# -eq 0 ]; then
# No arguments
help_menu
else
case $1 in
--help | -h)
help_menu
;;
--raise)
brightnessctl -c backlight s 10%+
;;
--lower)
brightnessctl -c backlight s 10%-
;;
--rofi)
rofi_menu
;;
esac
fi
}
main $@