summaryrefslogtreecommitdiffstats
path: root/Examples
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2014-07-22 09:02:57 +0200
committerDave Davenport <qball@gmpclient.org>2014-07-22 09:02:57 +0200
commit43bc36c1a666e4920228f7ad61e899e9bac61e56 (patch)
treec7a6c05487fd09ffc9d4d56b26823cb58cedbb0b /Examples
parent3c28012a87ba0d4dfbb50878710d03b1ffd37b31 (diff)
Add example script (laptop brightness), add i3 version to install.
Diffstat (limited to 'Examples')
-rwxr-xr-xExamples/brightness_rofi.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/Examples/brightness_rofi.sh b/Examples/brightness_rofi.sh
new file mode 100755
index 00000000..95c92e5a
--- /dev/null
+++ b/Examples/brightness_rofi.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+
+BPATH="/sys/devices/platform/s3c24xx-pwm.0/pwm-backlight.0/backlight/pwm-backlight.0"
+
+MINB=0
+MAXB=$(cat ${BPATH}/max_brightness)
+
+CUR=$(cat ${BPATH}/brightness)
+
+C_STATE=$(((${CUR}*100)/${MAXB}))
+
+function list_brightness()
+{
+ for val in 5 10 15 30 50 70 100
+ do
+ if [ ${val} -eq ${C_STATE} ]
+ then
+ echo "*${val} %"
+ else
+ echo "${val} %"
+ fi
+ done
+}
+
+if [ -z "$@" ]
+then
+ list_brightness
+else
+ if [ -n "$@" ]
+ then
+ if [[ ${@} =~ ^[0-9]+ ]]
+ then
+ VALUE=${@% *}
+ notify-send "Set brightness to: ${VALUE} %"
+ NEW_STATE=$((${VALUE}*${MAXB}/100))
+ echo ${NEW_STATE} > ${BPATH}/brightness
+ fi
+ fi
+fi
+