From 0da6ded3155f346de133436e8514fbd3b40b1ad7 Mon Sep 17 00:00:00 2001 From: TiynGER Date: Sat, 28 Mar 2020 13:11:45 +0100 Subject: [PATCH] cleaning up statusbar scripts --- .local/bin/statusbar/battery | 23 +---------------------- .local/bin/statusbar/clock | 5 ----- .local/bin/statusbar/cpu | 7 ------- .local/bin/statusbar/disk | 6 ------ .local/bin/statusbar/dwmbar | 2 +- .local/bin/statusbar/internet | 10 ---------- .local/bin/statusbar/memory | 6 ------ .local/bin/statusbar/volume | 10 ---------- .local/bin/tools/lmc | 2 -- 9 files changed, 2 insertions(+), 69 deletions(-) diff --git a/.local/bin/statusbar/battery b/.local/bin/statusbar/battery index 81912e9..beae402 100755 --- a/.local/bin/statusbar/battery +++ b/.local/bin/statusbar/battery @@ -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 "%s%s%s%s\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)" diff --git a/.local/bin/statusbar/clock b/.local/bin/statusbar/clock index b6f6e63..e7ea169 100755 --- a/.local/bin/statusbar/clock +++ b/.local/bin/statusbar/clock @@ -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//;s/..27m/<\/span><\/b>/")" ;; - 3) pgrep -x dunst >/dev/null && notify-send "📅 Time/date module" "\- Left click to show the month via \`cal\`" ;; -esac diff --git a/.local/bin/statusbar/cpu b/.local/bin/statusbar/cpu index 3b1394a..aabef3a 100755 --- a/.local/bin/statusbar/cpu +++ b/.local/bin/statusbar/cpu @@ -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}' diff --git a/.local/bin/statusbar/disk b/.local/bin/statusbar/disk index d9dedf3..b26c550 100755 --- a/.local/bin/statusbar/disk +++ b/.local/bin/statusbar/disk @@ -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}')" diff --git a/.local/bin/statusbar/dwmbar b/.local/bin/statusbar/dwmbar index b273e29..8901fdb 100755 --- a/.local/bin/statusbar/dwmbar +++ b/.local/bin/statusbar/dwmbar @@ -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' ' ')" diff --git a/.local/bin/statusbar/internet b/.local/bin/statusbar/internet index 8674658..660ac46 100755 --- a/.local/bin/statusbar/internet +++ b/.local/bin/statusbar/internet @@ -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) "%" }') diff --git a/.local/bin/statusbar/memory b/.local/bin/statusbar/memory index dfd3d7b..ad75caf 100755 --- a/.local/bin/statusbar/memory +++ b/.local/bin/statusbar/memory @@ -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}' diff --git a/.local/bin/statusbar/volume b/.local/bin/statusbar/volume index 3bbb32b..73efe42 100755 --- a/.local/bin/statusbar/volume +++ b/.local/bin/statusbar/volume @@ -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}') diff --git a/.local/bin/tools/lmc b/.local/bin/tools/lmc index c3f8d8e..c752937 100755 --- a/.local/bin/tools/lmc +++ b/.local/bin/tools/lmc @@ -19,5 +19,3 @@ Allowed options: EOF esac - -pkill -RTMIN+10 i3blocks