From 41c7b2a4ea0f9e81cf4d127b542c944e1ddb9a1b Mon Sep 17 00:00:00 2001 From: Vlad Doster Date: Thu, 2 Jan 2020 01:28:40 -0500 Subject: [PATCH] Removed cruft --- .local/bin/statusbar/battery | 32 -------------------------------- .local/bin/statusbar/clock | 10 ---------- .local/bin/statusbar/cpu | 10 ---------- .local/bin/statusbar/disk | 18 ------------------ .local/bin/statusbar/internet | 17 ----------------- .local/bin/statusbar/iplocate | 9 --------- .local/bin/statusbar/mailbox | 16 ---------------- .local/bin/statusbar/memory | 9 --------- .local/bin/statusbar/music | 18 ------------------ .local/bin/statusbar/news | 17 ----------------- .local/bin/statusbar/pacpackages | 18 ------------------ .local/bin/statusbar/popupgrade | 9 --------- .local/bin/statusbar/torrent | 28 ---------------------------- .local/bin/statusbar/volume | 27 --------------------------- .local/bin/statusbar/weather | 23 ----------------------- 15 files changed, 261 deletions(-) delete mode 100755 .local/bin/statusbar/battery delete mode 100755 .local/bin/statusbar/clock delete mode 100755 .local/bin/statusbar/cpu delete mode 100755 .local/bin/statusbar/disk delete mode 100755 .local/bin/statusbar/internet delete mode 100755 .local/bin/statusbar/iplocate delete mode 100755 .local/bin/statusbar/mailbox delete mode 100755 .local/bin/statusbar/memory delete mode 100755 .local/bin/statusbar/music delete mode 100755 .local/bin/statusbar/news delete mode 100755 .local/bin/statusbar/pacpackages delete mode 100755 .local/bin/statusbar/popupgrade delete mode 100755 .local/bin/statusbar/torrent delete mode 100755 .local/bin/statusbar/volume delete mode 100755 .local/bin/statusbar/weather diff --git a/.local/bin/statusbar/battery b/.local/bin/statusbar/battery deleted file mode 100755 index 677ecb49..00000000 --- a/.local/bin/statusbar/battery +++ /dev/null @@ -1,32 +0,0 @@ -#!/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 -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\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/$/%/')" diff --git a/.local/bin/statusbar/clock b/.local/bin/statusbar/clock deleted file mode 100755 index 8b418ebc..00000000 --- a/.local/bin/statusbar/clock +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env sh - -date '+%Y %b %d (%a) %I:%M%p' - -case $BLOCK_BUTTON in - 1) pgrep -x dunst >/dev/null && notify-send "This Month" "$(cal --color=always | sed "s/..7m//;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -D ~/.config/calcurse -d3)" ;; - 2) $TERMINAL -e calcurse -D ~/.config/calcurse ;; - 3) pgrep -x dunst >/dev/null && notify-send "📅 Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` -- Middle click opens calcurse if installed" ;; -esac diff --git a/.local/bin/statusbar/cpu b/.local/bin/statusbar/cpu deleted file mode 100755 index 08078ba9..00000000 --- a/.local/bin/statusbar/cpu +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env 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 deleted file mode 100755 index d9dedf3f..00000000 --- a/.local/bin/statusbar/disk +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env sh - -# Status bar module for disk space -# $1 should be drive mountpoint -# $2 is optional icon, otherwise mountpoint will displayed - -[ -z "$1" ] && exit - -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/internet b/.local/bin/statusbar/internet deleted file mode 100755 index 86746589..00000000 --- a/.local/bin/statusbar/internet +++ /dev/null @@ -1,17 +0,0 @@ -#!/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) "%" }') - -printf "%s %s\n" "$wifiicon" "$(cat /sys/class/net/e*/operstate | sed "s/down/❎/;s/up/🌐/")" diff --git a/.local/bin/statusbar/iplocate b/.local/bin/statusbar/iplocate deleted file mode 100755 index 5362330e..00000000 --- a/.local/bin/statusbar/iplocate +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env sh - -# Gets your public ip address checks which country you are in and -# displays that information in the statusbar -# -# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/ -ifinstalled "geoiplookup" || exit -addr="$(curl ifconfig.me 2>/dev/null)" || exit -grep "flag: " ~/.config/emoji | grep "$(geoiplookup $addr | sed 's/.*, //')" | sed "s/flag: //;s/;.*//" diff --git a/.local/bin/statusbar/mailbox b/.local/bin/statusbar/mailbox deleted file mode 100755 index f9d3bd80..00000000 --- a/.local/bin/statusbar/mailbox +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env sh - -# i3blocks mail module. -# Displays number of unread mail and an loading icon if updating. -# When clicked, brings up `neomutt`. - -case $BLOCK_BUTTON in - 1) "$TERMINAL" -e neomutt ;; - 2) setsid mailsync >/dev/null & ;; - 3) pgrep -x dunst >/dev/null && notify-send "📬 Mail module" "\- Shows unread mail -- Shows 🔃 if syncing mail -- Left click opens neomutt -- Middle click syncs mail" ;; -esac - -echo "$(du -a ~/.local/share/mail/*/INBOX/new/* 2>/dev/null | sed -n '$=')$(cat /tmp/imapsyncicon_$USER 2>/dev/null)" diff --git a/.local/bin/statusbar/memory b/.local/bin/statusbar/memory deleted file mode 100755 index c1282613..00000000 --- a/.local/bin/statusbar/memory +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env 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/music b/.local/bin/statusbar/music deleted file mode 100755 index 663fe0f7..00000000 --- a/.local/bin/statusbar/music +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env sh - -filter() { - sed "/^volume:/d" | tac | sed -e "s/\\&/&/g;s/\\[paused\\].*//g;s/\\[playing\\].*//g" | tr -d '\n' | sed -e "s/$/<\\/span>\n/g" - } - -case $BLOCK_BUTTON in - 1) mpc status | filter && setsid "$TERMINAL" -e ncmpcpp & ;; # right click, pause/unpause - 2) mpc toggle | filter ;; # right click, pause/unpause - 3) mpc status | filter && pgrep -x dunst >/dev/null && notify-send "🎵 Music module" "\- Shows mpd song playing. -- Italic when paused. -- Left click opens ncmpcpp. -- Middle click pauses. -- Scroll changes track.";; # right click, pause/unpause - 4) mpc prev | filter ;; # scroll up, previous - 5) mpc next | filter ;; # scroll down, next - *) mpc status | filter ;; -esac; exit diff --git a/.local/bin/statusbar/news b/.local/bin/statusbar/news deleted file mode 100755 index 9a0c1da3..00000000 --- a/.local/bin/statusbar/news +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env sh - -# i3blocks newsboat module. -# Displays number of unread news items and an loading icon if updating. -# When clicked, brings up `newsboat`. - -case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e newsboat ;; - 2) setsid newsup >/dev/null & exit ;; - 3) pgrep -x dunst >/dev/null && notify-send "📰 News module" "\- Shows unread news items -- Shows 🔃 if updating with \`newsup\` -- Left click opens newsboat -- Middle click syncs RSS feeds -Note: Only one instance of newsboat (including updates) may be running at a time." ;; -esac - - cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ print $1}' | sed s/^0$//g)$(cat ~/.config/newsboat/.update 2>/dev/null)" diff --git a/.local/bin/statusbar/pacpackages b/.local/bin/statusbar/pacpackages deleted file mode 100755 index e4cd4791..00000000 --- a/.local/bin/statusbar/pacpackages +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env sh - -# i3blocks module for pacman upgrades. -# Displays number of upgradeable packages. -# For this to work, have a `pacman -Sy` command run in the background as a -# cronjob every so often as root. This script will then read those packages. -# When clicked, it will run an upgrade via pacman. - -case $BLOCK_BUTTON in - 1) $TERMINAL -e popupgrade ;; - 2) notify-send "$(/usr/bin/pacman -Qu)" ;; - 3) pgrep -x dunst >/dev/null && notify-send "Upgrade module" "📦: number of upgradable packages -- Left click to upgrade packages -- Middle click to show upgradable packages" ;; -esac - - -pacman -Qu | grep -v "\[ignored\]" | wc -l | sed -e "s/^0$//g" diff --git a/.local/bin/statusbar/popupgrade b/.local/bin/statusbar/popupgrade deleted file mode 100755 index 099b259b..00000000 --- a/.local/bin/statusbar/popupgrade +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env sh - -printf "Beginning upgrade.\\n" - -yay -Syu -pkill -RTMIN+8 "${STATUSBAR:?}" - -printf "\\nUpgrade complete.\\nPress to exit window.\\n\\n" -read -r diff --git a/.local/bin/statusbar/torrent b/.local/bin/statusbar/torrent deleted file mode 100755 index c1387d12..00000000 --- a/.local/bin/statusbar/torrent +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env sh - -transmission-remote -l | grep % | - sed " # This first sed command is to ensure a desirable order with sort - s/.*Stopped.*/A/g; - s/.*Seeding.*/Z/g; - s/.*100%.*/N/g; - s/.*Idle.*/B/g; - s/.*Uploading.*/L/g; - s/.*%.*/M/g" | - sort -h | uniq -c | sed " # Now we replace the standin letters with icons. - s/A/🛑/g; - s/B/⌛️/g; - s/L/🔼/g; - s/M/🔽/g; - s/N/✅/g; - s/Z/🌱/g" | awk '{print $2, $1}' | sed -e "s/ $//g" - -case $BLOCK_BUTTON in - 1) $TERMINAL -e transmission-remote-cli ;; - 3) pgrep -x dunst >/dev/null && notify-send "Torrent module" "🛑: paused -⏳: idle (seeds needed) -🔼: uploading (unfinished) -🔽: downloading -✅: done -🌱: done and seeding" ;; -esac - diff --git a/.local/bin/statusbar/volume b/.local/bin/statusbar/volume deleted file mode 100755 index c3bf6d11..00000000 --- a/.local/bin/statusbar/volume +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env sh - -case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e alsamixer & ;; - 2) amixer sset Master toggle ;; - 4) amixer sset Master 5%+ >/dev/null 2>/dev/null ;; - 5) amixer sset Master 5%- >/dev/null 2>/dev/null ;; - 3) pgrep -x dunst >/dev/null && notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted. -- Middle click to mute. -- Scroll to change." -esac - -volstat="$(amixer get Master)" - -echo "$volstat" | grep "\[off\]" >/dev/null && printf "🔇\\n" && exit - -vol=$(echo "$volstat" | grep -o "\[[0-9]\+%\]" | sed 's/[^0-9]*//g') - -if [ "$vol" -gt "70" ]; then - icon="🔊" -elif [ "$vol" -lt "30" ]; then - icon="🔈" -else - icon="🔉" -fi - -printf "%s %s%%\\n" "$icon" "$vol" diff --git a/.local/bin/statusbar/weather b/.local/bin/statusbar/weather deleted file mode 100755 index 4241a510..00000000 --- a/.local/bin/statusbar/weather +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env sh -location="$1"; [ -z "$location" ] || { location="$location+" && rm -f "$HOME/.local/share/weatherreport" ;} - -getforecast() { ping -q -c 1 1.1.1.1 >/dev/null || exit 1 -curl -s "wttr.in/$location" > "$HOME/.local/share/weatherreport" || exit 1 ;} - -showweather() { printf "%s" "$(sed '16q;d' "$HOME/.local/share/weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')" -sed '13q;d' "$HOME/.local/share/weatherreport" | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄️",$1 "°","🌞",$2 "°"}' ;} - -case $BLOCK_BUTTON in - 1) $TERMINAL -e less -S "$HOME/.local/share/weatherreport" ;; - 2) getforecast && showweather ;; - 3) pgrep -x dunst >/dev/null && notify-send "🌈 Weather module" "\- Left click for full forecast. -- Middle click to update forecast. -☔: Chance of rain/snow -❄: Daily low -🌞: Daily high" ;; -esac - -if [ "$(stat -c %y "$HOME/.local/share/weatherreport" >/dev/null 2>&1 | awk '{print $1}')" != "$(date '+%Y-%m-%d')" ] - then getforecast && showweather - else showweather -fi