diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-02 17:50:44 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-02 17:50:44 +0200 |
| commit | dadac25a4e0c008cf5821b4d2f7bb6a27e9528f1 (patch) | |
| tree | 21f9055a38a7bfad71deb313691ff2299b4557cf /ak820-ctl/rc.ak820-lcd | |
| parent | 0c5f4df2088d1d132ee38aa4c75727d86daf9c48 (diff) | |
| download | my-slackbuilds-dadac25a4e0c008cf5821b4d2f7bb6a27e9528f1.tar.gz my-slackbuilds-dadac25a4e0c008cf5821b4d2f7bb6a27e9528f1.zip | |
ak820-ctl: add version 0.1.0+git20260414main
CLI and GUI control software for the Ajazz AK820 Pro keyboard
(lighting, sleep timer, clock sync). Upstream has no tags, so the
source is pinned to a commit and nvchecker tracks the commit date.
Ships a uaccess udev rule for 0c45:8009, a desktop entry for
ak820-gui, and rc.ak820-lcd, a Slackware replacement for upstream's
systemd unit that runs the lcd subcommand in a restart loop.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'ak820-ctl/rc.ak820-lcd')
| -rw-r--r-- | ak820-ctl/rc.ak820-lcd | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/ak820-ctl/rc.ak820-lcd b/ak820-ctl/rc.ak820-lcd new file mode 100644 index 0000000..9a30f7e --- /dev/null +++ b/ak820-ctl/rc.ak820-lcd @@ -0,0 +1,57 @@ +#!/bin/sh +# +# /etc/rc.d/rc.ak820-lcd: show CPU/GPU temperature and time on the +# Ajazz AK820 Pro TFT screen. +# +# To start at boot, make this script executable and add to /etc/rc.d/rc.local: +# [ -x /etc/rc.d/rc.ak820-lcd ] && /etc/rc.d/rc.ak820-lcd start +# and to /etc/rc.d/rc.local_shutdown: +# [ -x /etc/rc.d/rc.ak820-lcd ] && /etc/rc.d/rc.ak820-lcd stop + +PIDFILE=/var/run/ak820-lcd.pid +# Extra options for "ak820-ctl lcd", e.g. "--interval 5 --max-interval 60". +LCD_OPTS="" + +running() { + [ -r $PIDFILE ] && kill -0 $(cat $PIDFILE) 2>/dev/null +} + +start() { + if running ; then + echo "ak820-lcd is already running." + return + fi + echo "Starting ak820-lcd." + # ak820-ctl exits when the keyboard is unplugged or the upload fails, so + # restart it in a loop. setsid makes the loop a process group leader, + # which lets stop() kill the loop and ak820-ctl together. Progress + # output goes to /dev/null, errors to syslog. + setsid /bin/sh -c "while : ; do + /usr/bin/ak820-ctl lcd $LCD_OPTS 2>&1 >/dev/null | /usr/bin/logger -t ak820-lcd + sleep 30 + done" </dev/null >/dev/null 2>&1 & + echo $! > $PIDFILE +} + +stop() { + if running ; then + echo "Stopping ak820-lcd." + kill -- -$(cat $PIDFILE) + fi + rm -f $PIDFILE +} + +case "$1" in + start) start ;; + stop) stop ;; + restart) stop ; sleep 1 ; start ;; + status) + if running ; then + echo "ak820-lcd is running." + else + echo "ak820-lcd is stopped." + exit 1 + fi + ;; + *) echo "usage: $0 start|stop|restart|status" ; exit 1 ;; +esac |
