mirror of https://github.com/tiyn/dotfiles
parent
9de3398af2
commit
0da6ded315
@ -1,33 +1,12 @@
|
||||
#!/usr/bin/env sh
|
||||
# Give a battery name (e.g. BAT0) as an argument.
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
3) pgrep -x dunst >/dev/null && notify-send "🔋 Battery module" "🔋: discharging
|
||||
🛑: not charging
|
||||
♻: stagnant charge
|
||||
🔌: charging
|
||||
⚡: charged
|
||||
❗: battery very low!
|
||||
- Text color reflects charge left" ;;
|
||||
esac
|
||||
|
||||
capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit
|
||||
time=$(acpi | awk '{ print $5 }')
|
||||
status=$(cat /sys/class/power_supply/"$1"/status)
|
||||
|
||||
if [ "$capacity" -ge 75 ]; then
|
||||
color="#00ff00"
|
||||
elif [ "$capacity" -ge 50 ]; then
|
||||
color="#ffffff"
|
||||
elif [ "$capacity" -ge 25 ]; then
|
||||
color="#ffff00"
|
||||
else
|
||||
color="#ff0000"
|
||||
warn="❗"
|
||||
fi
|
||||
|
||||
[ -z $warn ] && warn=" "
|
||||
|
||||
[ "$status" = "Charging" ] && color="#ffffff"
|
||||
|
||||
printf "<span color='%s'>%s%s%s%s</span>\n" "$color" "$(echo "$status" | sed -e "s/,//;s/Discharging/🔋/;s/Not Charging/🛑/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/' ) " " ($time)"
|
||||
printf "%s%s%s\n" "$(echo "$status" | sed -e "s/,//;s/Discharging/🔋/;s/Not Charging/🛑/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/' ) " " ($time)"
|
||||
|
@ -1,10 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) notify-send "🖥 CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)" ;;
|
||||
3) notify-send "🖥 CPU module " "\- Shows CPU temperature.
|
||||
- Click to show intensive processes.
|
||||
- % is of single core." ;;
|
||||
esac
|
||||
|
||||
sensors | awk '/Core 0/ {print $3}'
|
||||
|
@ -1,9 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) notify-send "🧠 Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;;
|
||||
3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total.
|
||||
- Click to show memory hogs." ;;
|
||||
esac
|
||||
|
||||
free -h | awk '/^Mem:/ {print $3 "/" $2}'
|
||||
|
Loading…
Reference in new issue