Added kb_led_inc.sh and kb_led_dec.sh (I use because KDE increments by 3/10=0)

This commit is contained in:
Doncho N. Gunchev 2013-11-20 02:34:52 +02:00
parent f8c71d3ffa
commit 0fe8795d35
2 changed files with 20 additions and 0 deletions

10
kb_led_dec.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
cur=$(dbus-send --print-reply=literal --type=method_call --system --dest=org.freedesktop.UPower /org/freedesktop/UPower/KbdBacklight org.freedesktop.UPower.KbdBacklight.GetBrightness | sed s/...int32.//g)
max=$(dbus-send --print-reply=literal --type=method_call --system --dest=org.freedesktop.UPower /org/freedesktop/UPower/KbdBacklight org.freedesktop.UPower.KbdBacklight.GetMaxBrightness | sed s/...int32.//g)
val=$(($cur - 1))
if (($val >= 0)); then
dbus-send --print-reply=literal --type=method_call --system --dest=org.freedesktop.UPower /org/freedesktop/UPower/KbdBacklight org.freedesktop.UPower.KbdBacklight.SetBrightness int32:$val
notify-send -t 500 -i /usr/share/icons/HighContrast/scalable/devices/input-keyboard.svg "Brightness $val/$max"
fi

10
kb_led_inc.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
cur=$(dbus-send --print-reply=literal --type=method_call --system --dest=org.freedesktop.UPower /org/freedesktop/UPower/KbdBacklight org.freedesktop.UPower.KbdBacklight.GetBrightness | sed s/...int32.//g)
max=$(dbus-send --print-reply=literal --type=method_call --system --dest=org.freedesktop.UPower /org/freedesktop/UPower/KbdBacklight org.freedesktop.UPower.KbdBacklight.GetMaxBrightness | sed s/...int32.//g)
val=$(($cur + 1))
if (($val <= $max)); then
dbus-send --print-reply=literal --type=method_call --system --dest=org.freedesktop.UPower /org/freedesktop/UPower/KbdBacklight org.freedesktop.UPower.KbdBacklight.SetBrightness int32:$val
notify-send -t 500 -i /usr/share/icons/HighContrast/scalable/devices/input-keyboard.svg "Brightness $val/$max"
fi