You are not logged in.
for the benefit of reading an ebook.
https://raw.githubusercontent.com/bront … Brightness
Tested on two machines now and seems to be working.
Patching to tint2, one could use clock rclick:
clock_rclick_command = toggleBrightness
Last edited by brontosaurusrex (2017-12-08 20:17:25)
Offline
Very useful and a good supplement to redshift. Thanks a lot!
Offline
Yw, p.s. actually this will probably fight with redshift for control (won't work with other words).
Offline
Yep, saw that. But outside of redshift's active timespan your script is working fine!
Offline
thanks for this.
i noticed a flaw: if someone/something puts the brightness to some other than those 2 values, script will fail.
so i added a failsafe "else".
also i hopefully made the search for the current brightness a little more robust, and changed the shell from bash to dash, which should increase its speed significantly.
#!/bin/dash
# software toggle brightness of primary/connected monitor
# for the benefit of reading an ebook
# https://wiki.archlinux.org/index.php/xrandr
normal="1.0"
reader="0.70"
now="$(xrandr --verbose | grep -wA10 connected | grep Brightness | cut -f2 -d ' ')"
monitor="$(xrandr | grep -E " connected (primary )?[1-9]+" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/")"
if [ "$now" = "$reader" ]; then
xrandr --output "$monitor" --brightness "$normal"
elif [ "$now" = "$normal" ]; then
xrandr --output "$monitor" --brightness "$reader"
else
xrandr --output "$monitor" --brightness "$normal"
fi
Offline
@ohnonot; added, also "tail -1" to get some basic protection against multihead configurations (It may or may not do what one wants).
Last edited by brontosaurusrex (2018-02-22 20:18:44)
Offline