scripts/wraithCtl.sh

26 lines
697 B
Bash
Raw Normal View History

2020-06-24 00:25:39 +02:00
#!/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
2020-06-24 00:54:57 +02:00
pout=($(python3 -c "p=min(max(($load/16), 0), 1); print(int((p)*4)+1, int(p), int(p*255), int((1-p)*255))"))
2020-06-24 00:25:39 +02:00
speed=${pout[0]}
#gpu color
2020-06-24 00:54:57 +02:00
gp=($(python3 -c "p=min(max(($gpu/100), 0), 1); print(int(p*255), int((1-p)*255))"))
2020-06-24 00:25:39 +02:00
#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"