mirror of
https://github.com/CoolnsX/hyprdots.git
synced 2025-12-20 15:25:24 +05:30
20 lines
1.1 KiB
Bash
Executable File
20 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
||
|
||
top -ibn5 -d1 | while read -r line;do
|
||
new_cpu=$(printf "%s" "$line" | sed -nE 's_%Cpu\(s\):[[:space:]]*(.*) us,.*_\1 %_p')
|
||
new_mem=$(printf "%s" "$line" | sed -nE 's_MiB Mem :[[:space:]]*(.*) total,.*,[[:space:]]*(.*) used,.*_\2 MB / \1 MB_p')
|
||
cpu=${new_cpu:-$cpu}
|
||
mem=${new_mem:-$mem}
|
||
if [ -n "$new_mem" ];then
|
||
|
||
temp=$(cat /sys/class/thermal/thermal_zone0/temp)
|
||
: $((temp /= 1000))
|
||
bat_stats=$(cat /sys/class/power_supply/BAT0/status)
|
||
vol_stats=$(pamixer --get-volume-human)
|
||
charge=$(cat /sys/class/power_supply/BAT0/capacity)
|
||
[ "$bat_stats" = "Discharging" ] && { [ "$charge" -lt 20 ] && bat_icon=🪫 || bat_icon=🔋 ;} || bat_icon=🔌
|
||
[ "$vol_stats" = "muted" ] && vol_icon=🔇 || vol_icon=🔊
|
||
notify-send -i "lol" "<----------(STATS)---------->" "🧠 CPU usage : $cpu\n🌡️ Cpu Temp : $temp °C\n🔳 RAM : $mem\n$bat_icon Battery : $charge (${bat_stats})\n☀️ Brightness : $("$(dirname "$0")"/brightness s)%\n$vol_icon Volume : $vol_stats\n🎵 $(cut -d ">" -f1 /tmp/yt-music/current 2>/dev/null | cut -d":" -f2)" -h "string:x-canonical-private-synchronous:${0##*/}" -t 1500 &
|
||
fi
|
||
done
|