cleaning up statusbar scripts

master
TiynGER 5 years ago
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,8 +1,3 @@
#!/bin/sh
date +"%d %b '%y (%a) %H:%M"
case $BLOCK_BUTTON in
1) pgrep -x dunst >/dev/null && notify-send "This Month" "$(cal -m --color=always | sed "s/..7m/<b><span color=\"red\">/;s/..27m/<\/span><\/b>/")" ;;
3) pgrep -x dunst >/dev/null && notify-send "📅 Time/date module" "\- Left click to show the month via \`cal\`" ;;
esac

@ -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}'

@ -9,10 +9,4 @@
icon="$2"
[ -z "$2" ] && icon="$1"
case $BLOCK_BUTTON in
1) pgrep -x dunst >/dev/null && notify-send "💽 Disk space" "$(df -h --output=target,used,size)" ;;
3) pgrep -x dunst >/dev/null && notify-send "💽 Disk module" "\- Shows used hard drive space.
- Click to show all disk info." ;;
esac
printf "%s: %s\n" "$icon" "$(df -h "$1" | awk ' /[0-9]/ {print $3 "/" $2}')"

@ -1,6 +1,6 @@
#!/bin/sh
status() { \
echo "$(volume) | $(internet) | $(clock)"
echo "$(memory) | $(cpu) | $(disk /) | $(volume) | $(battery BAT0) | $(internet) | $(clock)"
}
while :; do
xsetroot -name "$(status | tr '\n' ' ')"

@ -1,15 +1,5 @@
#!/usr/bin/env sh
case $BLOCK_BUTTON in
1) $TERMINAL -e nmtui ;;
3) pgrep -x dunst >/dev/null && notify-send "🌐 Internet module" "\- Click to connect
📡: no wifi connection
📶: wifi connection with quality
❎: no ethernet
🌐: ethernet working
" ;;
esac
[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="📡"
[ ! -n "${wifiicon+var}" ] && wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "📶", int($3 * 100 / 70) "%" }')

@ -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}'

@ -1,15 +1,5 @@
#!/bin/sh
case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e pulsemixer & ;;
2) pulsemixer --toggle-mute ;;
4) pulsemixer --change-volume +5 ;;
5) pulsemixer --change-volume -5 ;;
3) pgrep -x dunst >/dev/null && notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted.
- Middle click to mute.
- Scroll to change."
esac
[ "$(pulsemixer --get-mute)" = "1" ] && printf "🔇\\n" && exit
vol=$(pulsemixer --get-volume | awk '{print $1}')

@ -19,5 +19,3 @@ Allowed options:
EOF
esac
pkill -RTMIN+10 i3blocks

Loading…
Cancel
Save