New package: asus-kbd-backlight-1.2

This commit is contained in:
Andrea Brancaleoni 2016-03-25 17:40:25 +01:00
parent 9094bf1ad6
commit 4165338666
3 changed files with 90 additions and 0 deletions

View file

@ -0,0 +1,69 @@
#!/bin/bash
path="/sys/class/leds/asus::kbd_backlight"
if [ ! -e "$path" ]; then
path="/sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight"
fi
# max should be 3
max=$(cat ${path}/max_brightness)
# step: represent the difference between previous and next brightness
step=1
previous=$(cat ${path}/brightness)
function commit {
if [[ $1 = [0-9]* ]]
then
if [[ $1 -gt $max ]]
then
next=$max
elif [[ $1 -lt 0 ]]
then
next=0
else
next=$1
fi
echo $next >> ${path}/brightness
exit 0
else
exit 1
fi
}
case "$1" in
up)
commit $(($previous + $step))
;;
down)
commit $(($previous - $step))
;;
max)
commit $max
;;
on)
$0 max
;;
off)
commit 0
;;
show)
echo $previous
;;
night)
commit 1
;;
allowusers)
# Allow members of users group to change brightness
chgrp users ${path}/brightness
chmod g+w ${path}/brightness
;;
disallowusers)
# Allow members of users group to change brightness
chgrp root ${path}/brightness
chmod g-w ${path}/brightness
;;
*)
commit $1
esac
exit 0

View file

@ -0,0 +1,5 @@
#!/bin/sh
asus-kbd-backlight allowusers
exec chpst -b asus-kbd pause

View file

@ -0,0 +1,16 @@
# Template file for 'asus-kbd-backlight'
pkgname=asus-kbd-backlight
version=1.2
revision=1
create_wrksrc=yes
noarch=yes
depends="bash"
short_desc="Helper for adjusting keyboard backlight brightness in Asus Zenbook"
maintainer="Andrea Brancaleoni <miwaxe@gmail.com>"
license="FDL1.3"
homepage="https://wiki.archlinux.org/index.php/ASUS_Zenbook_Prime_UX31A#keyboard_backlight_script"
do_install() {
vbin $FILESDIR/asus-kbd-backlight
vsv asus-kbd
}