Created
January 28, 2022 18:40
-
-
Save zentrification/fb4ba232456fed3267b6bc58bb689f8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# change monitor brightness each hour | |
1 * * * * /home/chris/bin/polybar/monitor_brightness redshift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sudo ddcutil detect | |
IDS="4 5 6 7" | |
get_brightness() { | |
sudo ddcutil getvcp 10 -b $1 -t | cut -d ' ' -f 4 | |
} | |
set_brightness() { | |
sudo ddcutil setvcp 10 $2 -b $1 & | |
} | |
all_monitors() { | |
for ID in $IDS; do $1 $ID $2; done | |
} | |
decrease() { | |
set_brightness $1 $(($(get_brightness $1) - 10)) | |
} | |
increase() { | |
set_brightness $1 $(($(get_brightness $1) + 10)) | |
} | |
case $1 in | |
decrease) | |
all_monitors decrease | |
;; | |
increase) | |
all_monitors increase | |
;; | |
set) | |
all_monitors set_brightness $2 | |
;; | |
redshift) | |
all_monitors set_brightness $(redshift -p | grep Brightness | awk '{ print $2*100 }') | |
;; | |
*) | |
all_monitors get_brightness | tr '\n' ' ' | |
;; | |
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
, ((modm .|. shiftMask, xK_Up ), spawn "~/bin/polybar/monitor_brightness increase") | |
, ((modm .|. shiftMask, xK_Down), spawn "~/bin/polybar/monitor_brightness decrease") | |
let brightness = \(k, b) -> ((0, k), spawn ("/home/chris/bin/polybar/monitor_brightness set " ++ show b)) | |
in map brightness (zip ([xK_1..xK_9] ++ [xK_0]) [10,20..]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment