scripts/wraithCtl.sh

26 lines
697 B
Bash
Executable File

#!/bin/bash
#get the system load
load=$(cut -d" " -f1 /proc/loadavg)
gpu=$(nvidia-smi -q -d Utilization -i 0 | head -n 11 | tail -n 1 | cut -d" " -f35)
#calculate speed, avg load, r, g, b
pout=($(python3 -c "p=min(max(($load/16), 0), 1); print(int((p)*4)+1, int(p), int(p*255), int((1-p)*255))"))
speed=${pout[0]}
#gpu color
gp=($(python3 -c "p=min(max(($gpu/100), 0), 1); print(int(p*255), int((1-p)*255))"))
#setgpu color
gpucolor="${gp[0]},${gp[1]},0"
echo "set gpu load: $gpu % color: $gpucolor"
wraith-master fan -m static -c $gpucolor
#set cpu
color="${pout[2]},${pout[3]},0"
echo "set speed to: $speed(1-5), color: $color"
wraith-master ring -m swirl -s $speed -c $color
echo "Done"