From 5bef46cde2edcfcdd50138c3c5d6229bfbd1debc Mon Sep 17 00:00:00 2001 From: HelionSmoker <82761116+HelionSmoker@users.noreply.github.com> Date: Sun, 21 Nov 2021 21:21:12 +0200 Subject: [PATCH] Replacement for dwmblocks --- .local/bin/dstatus | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .local/bin/dstatus diff --git a/.local/bin/dstatus b/.local/bin/dstatus new file mode 100644 index 00000000..4213d3fd --- /dev/null +++ b/.local/bin/dstatus @@ -0,0 +1,32 @@ +#!/bin/sh + +# A hacky script that replaces 'dwmblocks' and provides a similar +# interface in 'dmenu'. + +# Show basic information, but allow extra options. +info=$(date '+šŸ•› %H:%M\nšŸ“… %d-%b (%a)')'\n'$(sh ~/.local/bin/sb-battery) +opt=$(echo -e $info'\nCrypto\nForecast' | dmenu -p "Quick info" -i) + +case $opt in + "Disk") + # Show all mounted partitions and their sizes, sorted so '/' is first + lsblk | awk '/[0-9]/ {if ($7) print $7 ":" $4}' | sort | dmenu -p "šŸ’¾ Partitions";; + + "Forecast") + # Show a summary. Pressing shows all content, exists + pause=$(sh ~/src/sb/sb-forecast | dmenu -i -p "🌈 Forecast") + "$TERMINAL" -e less ~/.local/share/weatherreport ;; + + "Crypto") + # Usage: + prices=$(sh ~/.local/bin/sb-price BTC šŸ’©)'\n' + prices+=$(sh ~/.local/bin/sb-price ETH šŸš€)'\n' + prices+=$(sh ~/.local/bin/sb-price BAT 🦁) + + # Same as 'pause' from above, but we actually use the output + out=$(echo -e $prices | dmenu -i -l -1 -p "šŸŖ™ Select currency") + chartdir="${XDG_DATA_HOME:-$HOME/.local/share}/crypto-prices/" + + # Get coin name and open its chart. + "$TERMINAL" -e less $chartdir$(echo $out | awk '{print $2}')*'-chart' ;; +esac