From 865cfdb0293f85c28d1ee54d76a11cc798bb7440 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 16 Dec 2018 16:50:42 -0500 Subject: Great Renaming, i3blocks officially changed --- .scripts/statusbar/battery | 35 +++++++++++++++++++++++++++++++++++ .scripts/statusbar/clock | 12 ++++++++++++ .scripts/statusbar/cpu | 12 ++++++++++++ .scripts/statusbar/disk | 20 ++++++++++++++++++++ .scripts/statusbar/help | 9 +++++++++ .scripts/statusbar/i3battery | 34 ---------------------------------- .scripts/statusbar/i3cpu | 12 ------------ .scripts/statusbar/i3date | 12 ------------ .scripts/statusbar/i3disk | 20 -------------------- .scripts/statusbar/i3help | 9 --------- .scripts/statusbar/i3internet | 18 ------------------ .scripts/statusbar/i3mail | 18 ------------------ .scripts/statusbar/i3mem | 11 ----------- .scripts/statusbar/i3mpd | 19 ------------------- .scripts/statusbar/i3mpdupdate | 9 --------- .scripts/statusbar/i3news | 18 ------------------ .scripts/statusbar/i3pacman | 16 ---------------- .scripts/statusbar/i3torrent | 6 ------ .scripts/statusbar/i3volume | 26 -------------------------- .scripts/statusbar/i3weather | 22 ---------------------- .scripts/statusbar/internet | 18 ++++++++++++++++++ .scripts/statusbar/mailbox | 18 ++++++++++++++++++ .scripts/statusbar/memory | 11 +++++++++++ .scripts/statusbar/music | 19 +++++++++++++++++++ .scripts/statusbar/news | 18 ++++++++++++++++++ .scripts/statusbar/pacpackages | 16 ++++++++++++++++ .scripts/statusbar/torrent | 26 ++++++++++++++++++++++++++ .scripts/statusbar/volume | 26 ++++++++++++++++++++++++++ .scripts/statusbar/weather | 22 ++++++++++++++++++++++ 29 files changed, 262 insertions(+), 250 deletions(-) create mode 100755 .scripts/statusbar/battery create mode 100755 .scripts/statusbar/clock create mode 100755 .scripts/statusbar/cpu create mode 100755 .scripts/statusbar/disk create mode 100755 .scripts/statusbar/help delete mode 100755 .scripts/statusbar/i3battery delete mode 100755 .scripts/statusbar/i3cpu delete mode 100755 .scripts/statusbar/i3date delete mode 100755 .scripts/statusbar/i3disk delete mode 100755 .scripts/statusbar/i3help delete mode 100755 .scripts/statusbar/i3internet delete mode 100755 .scripts/statusbar/i3mail delete mode 100755 .scripts/statusbar/i3mem delete mode 100755 .scripts/statusbar/i3mpd delete mode 100755 .scripts/statusbar/i3mpdupdate delete mode 100755 .scripts/statusbar/i3news delete mode 100755 .scripts/statusbar/i3pacman delete mode 100755 .scripts/statusbar/i3torrent delete mode 100755 .scripts/statusbar/i3volume delete mode 100755 .scripts/statusbar/i3weather create mode 100755 .scripts/statusbar/internet create mode 100755 .scripts/statusbar/mailbox create mode 100755 .scripts/statusbar/memory create mode 100755 .scripts/statusbar/music create mode 100755 .scripts/statusbar/news create mode 100755 .scripts/statusbar/pacpackages create mode 100755 .scripts/statusbar/torrent create mode 100755 .scripts/statusbar/volume create mode 100755 .scripts/statusbar/weather (limited to '.scripts') diff --git a/.scripts/statusbar/battery b/.scripts/statusbar/battery new file mode 100755 index 0000000..b2634e6 --- /dev/null +++ b/.scripts/statusbar/battery @@ -0,0 +1,35 @@ +#!/bin/sh +# Give a battery name (e.g. BAT0) as an argument. + +# get xresources colors +for x in "$(xrdb -query | sed "s/.*\./export /g;s/:\s*/=\"/g;s/$/\"/g")"; do eval "$x"; done + +case $BLOCK_BUTTON in + 3) pgrep -x dunst >/dev/null && notify-send "🔋 Battery module: +🔋: discharging +♻: 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="$color10" +elif [ "$capacity" -ge 50 ]; then + color="$color15" +elif [ "$capacity" -ge 25 ]; then + color="$color11" +else + color="$color9" + warn="❗" +fi + +[ -z $warn ] && warn=" " + +[ "$status" = "Charging" ] && color="$color15" + +printf "%s%s%s" "$color" "$(echo "$status" | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')" diff --git a/.scripts/statusbar/clock b/.scripts/statusbar/clock new file mode 100755 index 0000000..caed51a --- /dev/null +++ b/.scripts/statusbar/clock @@ -0,0 +1,12 @@ +#!/bin/sh + +date '+%Y %b %d (%a) %I:%M%p' + +case $BLOCK_BUTTON in + 1) pgrep -x dunst >/dev/null && notify-send "$(cal --color=always | sed "s/..7m//;s/..27m/<\/span><\/b>/")" ;; + 2) "$TERMINAL" -e calcurse ;; + 3) pgrep -x dunst >/dev/null && notify-send "📅 Time/date module: +- Left click to show month via \`cal\` +- Middle click opens calcurse if installed" ;; +esac + diff --git a/.scripts/statusbar/cpu b/.scripts/statusbar/cpu new file mode 100755 index 0000000..fc9d617 --- /dev/null +++ b/.scripts/statusbar/cpu @@ -0,0 +1,12 @@ +#!/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/.scripts/statusbar/disk b/.scripts/statusbar/disk new file mode 100755 index 0000000..3a12394 --- /dev/null +++ b/.scripts/statusbar/disk @@ -0,0 +1,20 @@ +#!/bin/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 "💽 Hard drive space remaining: +- Shows used hard drive space. +- Click to show all disk info." ;; +esac + +printf "%s: %s" "$icon" "$(df -h "$1" | awk ' /[0-9]/ {print $3 "/" $2}')" diff --git a/.scripts/statusbar/help b/.scripts/statusbar/help new file mode 100755 index 0000000..eacb15b --- /dev/null +++ b/.scripts/statusbar/help @@ -0,0 +1,9 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 1) groff -mom ~/.readme.mom -Tpdf | zathura - ;; + 3) pgrep -x dunst >/dev/null && notify-send "❓ Help module: +- Left click to open LARBS guide.";; +esac + +echo "❓" diff --git a/.scripts/statusbar/i3battery b/.scripts/statusbar/i3battery deleted file mode 100755 index b485d9a..0000000 --- a/.scripts/statusbar/i3battery +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/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 -♻: 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 80 ]; then - color="#b8bb26" -elif [ "$capacity" -ge 60 ]; then - color="#ebdbb2" -elif [ "$capacity" -ge 40 ]; then - color="#fabd2f" -elif [ "$capacity" -ge 20 ]; then - color="#fe8019" -else - color="#fb4934" - warn="❗" -fi - -[ -z $warn ] && warn=" " - -[ "$status" = "Charging" ] && color="#FFF" - -printf "%s%s%s" "$color" "$(echo "$status" | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')" diff --git a/.scripts/statusbar/i3cpu b/.scripts/statusbar/i3cpu deleted file mode 100755 index 7dbdc1f..0000000 --- a/.scripts/statusbar/i3cpu +++ /dev/null @@ -1,12 +0,0 @@ -#!/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 '/^temp1/ {print $2}' diff --git a/.scripts/statusbar/i3date b/.scripts/statusbar/i3date deleted file mode 100755 index caed51a..0000000 --- a/.scripts/statusbar/i3date +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -date '+%Y %b %d (%a) %I:%M%p' - -case $BLOCK_BUTTON in - 1) pgrep -x dunst >/dev/null && notify-send "$(cal --color=always | sed "s/..7m//;s/..27m/<\/span><\/b>/")" ;; - 2) "$TERMINAL" -e calcurse ;; - 3) pgrep -x dunst >/dev/null && notify-send "📅 Time/date module: -- Left click to show month via \`cal\` -- Middle click opens calcurse if installed" ;; -esac - diff --git a/.scripts/statusbar/i3disk b/.scripts/statusbar/i3disk deleted file mode 100755 index 3a12394..0000000 --- a/.scripts/statusbar/i3disk +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/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 "💽 Hard drive space remaining: -- Shows used hard drive space. -- Click to show all disk info." ;; -esac - -printf "%s: %s" "$icon" "$(df -h "$1" | awk ' /[0-9]/ {print $3 "/" $2}')" diff --git a/.scripts/statusbar/i3help b/.scripts/statusbar/i3help deleted file mode 100755 index eacb15b..0000000 --- a/.scripts/statusbar/i3help +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -case $BLOCK_BUTTON in - 1) groff -mom ~/.readme.mom -Tpdf | zathura - ;; - 3) pgrep -x dunst >/dev/null && notify-send "❓ Help module: -- Left click to open LARBS guide.";; -esac - -echo "❓" diff --git a/.scripts/statusbar/i3internet b/.scripts/statusbar/i3internet deleted file mode 100755 index e26e633..0000000 --- a/.scripts/statusbar/i3internet +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -case $BLOCK_BUTTON in - 1) $TERMINAL -e nmtui ;; - 3) pgrep -x dunst >/dev/null && notify-send "🌐 Internet module: -- Click for \`nmtui\` for wifi access -📡: 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" "$wifiicon" "$(cat /sys/class/net/e*/operstate | sed "s/down/❎/;s/up/🌐/")" diff --git a/.scripts/statusbar/i3mail b/.scripts/statusbar/i3mail deleted file mode 100755 index bb72c5d..0000000 --- a/.scripts/statusbar/i3mail +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/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 $HOME/.config/mutt/etc/mailsync.sh >/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 ~/.mail/*/INBOX/new/* 2>/dev/null | sed -n '$=')$(cat ~/.config/mutt/.dl 2>/dev/null)" - diff --git a/.scripts/statusbar/i3mem b/.scripts/statusbar/i3mem deleted file mode 100755 index 40705c4..0000000 --- a/.scripts/statusbar/i3mem +++ /dev/null @@ -1,11 +0,0 @@ -#!/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/.scripts/statusbar/i3mpd b/.scripts/statusbar/i3mpd deleted file mode 100755 index ef3a6c3..0000000 --- a/.scripts/statusbar/i3mpd +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -filter() { - sed "/^volume:/d" | tac | sed -e "s/\\&/&/g;s/\\[paused\\].*//g;s/\\[playing\\].*//g" | tr -d '\n' | sed -e "s/$/<\\/span>/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 diff --git a/.scripts/statusbar/i3mpdupdate b/.scripts/statusbar/i3mpdupdate deleted file mode 100755 index 646b49e..0000000 --- a/.scripts/statusbar/i3mpdupdate +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -[ "$(pgrep -x i3mpdupdate | wc -l)" -gt 2 ] && exit - -while : ; do - pgrep -x mpd || exit - mpc idle > /dev/null - pkill -RTMIN+11 i3blocks ; -done diff --git a/.scripts/statusbar/i3news b/.scripts/statusbar/i3news deleted file mode 100755 index 9a036f5..0000000 --- a/.scripts/statusbar/i3news +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/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 ;; - 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 - -echo "$(newsboat -x print-unread | awk '{ print $1}' | sed s/^0$//g)$(cat ~/.config/newsboat/.update 2>/dev/null)" diff --git a/.scripts/statusbar/i3pacman b/.scripts/statusbar/i3pacman deleted file mode 100755 index 1207e2c..0000000 --- a/.scripts/statusbar/i3pacman +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/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 ;; - 3) pgrep -x dunst >/dev/null && notify-send "Upgrade module: -📦: number of upgradable packages" ;; -esac - - -pacman -Qu | wc -l | sed -e "s/^0$//g" diff --git a/.scripts/statusbar/i3torrent b/.scripts/statusbar/i3torrent deleted file mode 100755 index 603ff01..0000000 --- a/.scripts/statusbar/i3torrent +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -case $BLOCK_BUTTON in - 1) $TERMINAL -e transmission-remote-cli -esac - -transmission-remote -l | grep % | sed -e "s/.*100%.*/Z/g;s/.*Idle.*/A/g;s/.*%.*/M/g" | sort -h | uniq -c | sed -e "s/Z/🌱/g;s/M/⬇️/g;s/A/⌛️/g" | awk '{print $2, $1}' | tr '\n' ' ' | sed -e "s/ $//g" diff --git a/.scripts/statusbar/i3volume b/.scripts/statusbar/i3volume deleted file mode 100755 index 26e5a17..0000000 --- a/.scripts/statusbar/i3volume +++ /dev/null @@ -1,26 +0,0 @@ -#!/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}') - -if [ "$vol" -gt "70" ]; then - icon="🔊" -elif [ "$vol" -lt "30" ]; then - icon="🔈" -else - icon="🔉" -fi - -printf "%s %s%%\\n" "$icon" "$vol" diff --git a/.scripts/statusbar/i3weather b/.scripts/statusbar/i3weather deleted file mode 100755 index a6c8d75..0000000 --- a/.scripts/statusbar/i3weather +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -### This is only if your location isn't automatically detected, otherwise you can leave it blank. -location="" - -case $BLOCK_BUTTON in - 1) $TERMINAL -e less -S ~/.weatherreport ;; - 3) pgrep -x dunst >/dev/null && notify-send "🌈 Weather module: -- Click for wttr.in forecast. -☔: Chance of rain/snow -❄: Daily low -🌞: Daily high" ;; -esac - -[ "$location" != "" ] && location="$location+" - -ping -q -w 1 -c 1 "$(ip r | grep default | tail -1 | cut -d ' ' -f 3)" >/dev/null || exit - -curl -s wttr.in/$location > ~/.weatherreport - -printf "%s" "$(sed '16q;d' ~/.weatherreport | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')" - -sed '13q;d' ~/.weatherreport | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄️",$1 "°","🌞",$2 "°"}' diff --git a/.scripts/statusbar/internet b/.scripts/statusbar/internet new file mode 100755 index 0000000..e26e633 --- /dev/null +++ b/.scripts/statusbar/internet @@ -0,0 +1,18 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 1) $TERMINAL -e nmtui ;; + 3) pgrep -x dunst >/dev/null && notify-send "🌐 Internet module: +- Click for \`nmtui\` for wifi access +📡: 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" "$wifiicon" "$(cat /sys/class/net/e*/operstate | sed "s/down/❎/;s/up/🌐/")" diff --git a/.scripts/statusbar/mailbox b/.scripts/statusbar/mailbox new file mode 100755 index 0000000..bb72c5d --- /dev/null +++ b/.scripts/statusbar/mailbox @@ -0,0 +1,18 @@ +#!/bin/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 $HOME/.config/mutt/etc/mailsync.sh >/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 ~/.mail/*/INBOX/new/* 2>/dev/null | sed -n '$=')$(cat ~/.config/mutt/.dl 2>/dev/null)" + diff --git a/.scripts/statusbar/memory b/.scripts/statusbar/memory new file mode 100755 index 0000000..40705c4 --- /dev/null +++ b/.scripts/statusbar/memory @@ -0,0 +1,11 @@ +#!/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/.scripts/statusbar/music b/.scripts/statusbar/music new file mode 100755 index 0000000..ef3a6c3 --- /dev/null +++ b/.scripts/statusbar/music @@ -0,0 +1,19 @@ +#!/bin/sh + +filter() { + sed "/^volume:/d" | tac | sed -e "s/\\&/&/g;s/\\[paused\\].*//g;s/\\[playing\\].*//g" | tr -d '\n' | sed -e "s/$/<\\/span>/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 diff --git a/.scripts/statusbar/news b/.scripts/statusbar/news new file mode 100755 index 0000000..95c9f18 --- /dev/null +++ b/.scripts/statusbar/news @@ -0,0 +1,18 @@ +#!/bin/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 + +echo "$(newsboat -x print-unread | awk '{ print $1}' | sed s/^0$//g)$(cat ~/.config/newsboat/.update 2>/dev/null)" diff --git a/.scripts/statusbar/pacpackages b/.scripts/statusbar/pacpackages new file mode 100755 index 0000000..1207e2c --- /dev/null +++ b/.scripts/statusbar/pacpackages @@ -0,0 +1,16 @@ +#!/bin/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 ;; + 3) pgrep -x dunst >/dev/null && notify-send "Upgrade module: +📦: number of upgradable packages" ;; +esac + + +pacman -Qu | wc -l | sed -e "s/^0$//g" diff --git a/.scripts/statusbar/torrent b/.scripts/statusbar/torrent new file mode 100755 index 0000000..06ddd3e --- /dev/null +++ b/.scripts/statusbar/torrent @@ -0,0 +1,26 @@ +#!/bin/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/.*%.*/M/g" | + sort -h | uniq -c | sed " # Now we replace the standin letters with icons. + s/A/🛑/g; + s/B/⌛️/g; + s/M/🔽/g; + s/N/✅/g; + s/Z/🌱/g" | awk '{print $2, $1}' | tr '\n' ' ' | 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 +⏳: waiting +🔽: downloading +✅: done +🌱: done and seeding" ;; +esac + diff --git a/.scripts/statusbar/volume b/.scripts/statusbar/volume new file mode 100755 index 0000000..26e5a17 --- /dev/null +++ b/.scripts/statusbar/volume @@ -0,0 +1,26 @@ +#!/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}') + +if [ "$vol" -gt "70" ]; then + icon="🔊" +elif [ "$vol" -lt "30" ]; then + icon="🔈" +else + icon="🔉" +fi + +printf "%s %s%%\\n" "$icon" "$vol" diff --git a/.scripts/statusbar/weather b/.scripts/statusbar/weather new file mode 100755 index 0000000..a6c8d75 --- /dev/null +++ b/.scripts/statusbar/weather @@ -0,0 +1,22 @@ +#!/bin/sh +### This is only if your location isn't automatically detected, otherwise you can leave it blank. +location="" + +case $BLOCK_BUTTON in + 1) $TERMINAL -e less -S ~/.weatherreport ;; + 3) pgrep -x dunst >/dev/null && notify-send "🌈 Weather module: +- Click for wttr.in forecast. +☔: Chance of rain/snow +❄: Daily low +🌞: Daily high" ;; +esac + +[ "$location" != "" ] && location="$location+" + +ping -q -w 1 -c 1 "$(ip r | grep default | tail -1 | cut -d ' ' -f 3)" >/dev/null || exit + +curl -s wttr.in/$location > ~/.weatherreport + +printf "%s" "$(sed '16q;d' ~/.weatherreport | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')" + +sed '13q;d' ~/.weatherreport | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄️",$1 "°","🌞",$2 "°"}' -- cgit v1.3.1