1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Add example script (laptop brightness), add i3 version to install.

This commit is contained in:
Dave Davenport 2014-07-22 09:02:57 +02:00
parent 3c28012a87
commit 43bc36c1a6
3 changed files with 47 additions and 0 deletions

40
Examples/brightness_rofi.sh Executable file
View file

@ -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

View file

@ -1,6 +1,11 @@
Installation guide: Installation guide:
=================== ===================
DEPENDENCY
----------
For i3 support, you need at least i3 version 4.5 or up.
Install from a release Install from a release
---------------------- ----------------------

View file

@ -69,6 +69,8 @@ EXTRA_DIST=\
$(markdown_FILES)\ $(markdown_FILES)\
$(markdown_SC_FILES)\ $(markdown_SC_FILES)\
Examples/i3_switch_workspaces.sh\ Examples/i3_switch_workspaces.sh\
Examples/brightness_rofi.sh\
Examples/domo_rofi_script.sh\
INSTALL.md INSTALL.md
## ##