DSK: Update g910 service

This commit is contained in:
Salt 2019-04-16 15:59:35 -05:00
parent d2fecf8ce8
commit 4e5d0e2f7b

View File

@ -28,13 +28,8 @@ rsleep() {
}
# Main loop
loop-i3() {
while rsleep 1; do
:
done
}
loop-stats() {
while rsleep 1; do
while :; do
# CPU stats on F1 and G6
g910-led -kn f1 $colorblue
if (( $(grep 'cpu ' /proc/stat | awk '{usage=($2+$4)/($2+$4+$5)} END {print (usage > 0.75)}') )); then
@ -66,16 +61,23 @@ loop-stats() {
# Commit
g910-led -c
# Wait
rsleep 1
done
}
initloops() {
# i3wm integration
if pgrep i3 > /dev/null 2>&1; then
g910-led -k logo ffffff
loop-i3 &
log "Starting i3 integration with PID $!"
else
log "Coloring i3 related keys"
g910-led -k logo 000000
rsleep 0.025
g910-led -kn logo $colorred
g910-led -kn alt_left $colorred
g910-led -kn alt_right $colorred
g910-led -kn win_left $colorblue
g910-led -kn win_right $colorblue
g910-led -c
fi
# General loops
loop-stats &
@ -150,7 +152,9 @@ main() {
log "Flickering modifier keys on"
g910-led -g modifiers 444444
rsleep 0.025
g910-led -g modifiers 888888
g910-led -gn modifiers 888888
g910-led -kn menu 000000
g910-led -c
rsleep 0.05
log "Flickering multimedia keys on"