mirror of
https://github.com/void-linux/void-packages.git
synced 2025-06-07 15:43:49 +02:00
Merge pull request #3899 from thypon/asus-kbd-backlight
New package: asus-kbd-backlight-1.2
This commit is contained in:
commit
30efb76a8c
3 changed files with 90 additions and 0 deletions
69
srcpkgs/asus-kbd-backlight/files/asus-kbd-backlight
Executable file
69
srcpkgs/asus-kbd-backlight/files/asus-kbd-backlight
Executable 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
|
5
srcpkgs/asus-kbd-backlight/files/asus-kbd/run
Normal file
5
srcpkgs/asus-kbd-backlight/files/asus-kbd/run
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
asus-kbd-backlight allowusers
|
||||||
|
|
||||||
|
exec chpst -b asus-kbd pause
|
16
srcpkgs/asus-kbd-backlight/template
Normal file
16
srcpkgs/asus-kbd-backlight/template
Normal 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
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue