#!/bin/sh # # Copyright (c) 2020 Uwe Werler # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # # # This is a small script to adjust brightness at my Dell Latitude via xrand # because xbacklight / wsconsctl doesn't work. It's usually invoked my cwm. # Therefore I have the following bindings configured: # # # bind-key 4-F11 '~/bin/brightness.sh -0.1' # bind-key 4-F12 '~/bin/brightness.sh +0.1' # bind-key C4-F11 '~/bin/brightness.sh 0.5' # bind-key C4-F12 '~/bin/brightness.sh 1.0' xrandr --verbose | { while read _line; do case $_line in *\ connected*) DEV=${_line%% connected*} ;; Brightness:\ *) [[ ${1} == "1.0" ]] && { xrandr --output ${DEV} --brightness ${1}; continue; } [[ ${1} == "0.5" ]] && { xrandr --output ${DEV} --brightness ${1}; continue; } xrandr --output ${DEV} --brightness $( echo ${_line##Brightness: }${1} | bc) ;; esac done } #vim: set ai:ts=2:et:sw=2