[AGS] Bar: BT, Audio, SysInfo, Brightness

This commit is contained in:
2025-04-23 20:04:48 +02:00
parent 69484fc302
commit e93e051094
26 changed files with 825 additions and 223 deletions

20
scripts/cpu-utilization Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
# Get first snapshot
read cpu user nice system idle iowait irq softirq steal guest < /proc/stat
total1=$((user+nice+system+idle+iowait+irq+softirq+steal))
idle1=$idle
sleep 0.5
# Get second snapshot
read cpu user nice system idle iowait irq softirq steal guest < /proc/stat
total2=$((user+nice+system+idle+iowait+irq+softirq+steal))
idle2=$idle
# Calculate usage
total_diff=$((total2 - total1))
idle_diff=$((idle2 - idle1))
cpu_usage=$((100 * (total_diff - idle_diff) / total_diff))
echo "$cpu_usage"