diff options
author | awy <awy@awy.one> | 2025-08-24 14:08:03 +0300 |
---|---|---|
committer | awy <awy@awy.one> | 2025-08-24 14:08:03 +0300 |
commit | 474006cd2c173d02e4511045f07c04e159010d4e (patch) | |
tree | c6d494b835f0a2914493b1511c3af70b7009cff7 /.local | |
parent | 632c51ed3ce26090e5ba67b27075bd1ac5848fca (diff) | |
download | hyprdots-474006cd2c173d02e4511045f07c04e159010d4e.tar.gz |
cleanup
Diffstat (limited to '.local')
26 files changed, 0 insertions, 711 deletions
diff --git a/.local/bin/statusbar/sb-doppler b/.local/bin/sb-doppler index 1930752..1930752 100755 --- a/.local/bin/statusbar/sb-doppler +++ b/.local/bin/sb-doppler diff --git a/.local/bin/statusbar/sb-internet b/.local/bin/sb-internet index 378cccb..378cccb 100755 --- a/.local/bin/statusbar/sb-internet +++ b/.local/bin/sb-internet diff --git a/.local/bin/statusbar/sb-mpdup b/.local/bin/sb-mpdup index 42bd737..42bd737 100755 --- a/.local/bin/statusbar/sb-mpdup +++ b/.local/bin/sb-mpdup diff --git a/.local/bin/statusbar/sb-news b/.local/bin/sb-news index bb45885..bb45885 100755 --- a/.local/bin/statusbar/sb-news +++ b/.local/bin/sb-news diff --git a/.local/bin/statusbar/sb-battery b/.local/bin/statusbar/sb-battery deleted file mode 100755 index 0e25e72..0000000 --- a/.local/bin/statusbar/sb-battery +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -# Prints all batteries, their percentage remaining and an emoji corresponding -# to charge status (π for plugged up, π for discharging on battery, etc.). - -case $BLOCK_BUTTON in - 3) notify-send "π Battery module" "π: discharging - π: not charging - β»: stagnant charge - π: charging - β‘: charged - β: battery very low! - - Scroll to change adjust xbacklight." ;; - 4) xbacklight -inc 10 ;; - 5) xbacklight -dec 10 ;; - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; -esac - -# Loop through all attached batteries and format the info -for battery in /sys/class/power_supply/BAT?*; do - # If non-first battery, print a space separator. - [ -n "${capacity+x}" ] && printf " " - # Sets up the status and capacity - case "$(bat "$battery/status" 2>&1)" in - "Full") status="β‘" ;; - "Discharging") status="π" ;; - "Charging") status="π" ;; - "Not charging") status="π" ;; - "Unknown") status="β»οΈ" ;; - *) exit 1 ;; - esac - capacity="$(bat "$battery/capacity" 2>&1)" - # Will make a warn variable if discharging and low - [ "$status" = "π" ] && [ "$capacity" -le 25 ] && warn="β" - # Prints the info - printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn -done && printf "\\n" diff --git a/.local/bin/statusbar/sb-brightness b/.local/bin/statusbar/sb-brightness deleted file mode 100755 index 30fe76b..0000000 --- a/.local/bin/statusbar/sb-brightness +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# current brightness -curr_brightness=$(bat /sys/class/backlight/*/brightness) - -# max_brightness -max_brightness=$(bat /sys/class/backlight/*/max_brightness) - -# brightness percentage -brightness_per=$((100 * curr_brightness / max_brightness)) - -case $BLOCK_BUTTON in - 1) - ;; - 3) - notify-send "π‘ Brightness module" "\- Shows current brightness level βοΈ." - ;; - 8) - setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 - ;; -esac - -echo "π‘ ${brightness_per}%" diff --git a/.local/bin/statusbar/sb-clock b/.local/bin/statusbar/sb-clock deleted file mode 100755 index 63e45d6..0000000 --- a/.local/bin/statusbar/sb-clock +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -clock=$(date '+%I') - -case $BLOCK_BUTTON in - 1) notify-send "This Month" "$(cal | sed "s/\<$(date +'%e'|tr -d ' ')\>/<b><span color='red'>&<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;; - 2) setsid -f "$TERMINAL" -e calcurse >/dev/null 2>&1 ;; - 3) 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" ;; - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; -esac - -date "+%H:%M" diff --git a/.local/bin/statusbar/sb-cpu b/.local/bin/statusbar/sb-cpu deleted file mode 100755 index e9c9cae..0000000 --- a/.local/bin/statusbar/sb-cpu +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -case $BLOCK_BUTTON in - 1) notify-send "π₯ CPU hogs" "$(ps axch -o cmd,%cpu | awk '{cmd[$1]+=$2} END {for (i in cmd) print i, cmd[i]}' | sort -nrk2 | head)\\n(100% per core)" ;; - 2) setsid -f "$TERMINAL" -e btop >/dev/null 2>&1 ;; - 3) notify-send "π₯ CPU module " "\- Shows CPU temperature. -- Click to show intensive processes. -- Middle click to open btop." ;; - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; -esac - -sensors | awk '/Core 0/ {print "π‘" $3}' diff --git a/.local/bin/statusbar/sb-cpubars b/.local/bin/statusbar/sb-cpubars deleted file mode 100755 index a0d5dce..0000000 --- a/.local/bin/statusbar/sb-cpubars +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -# Module showing CPU load as a changing bars. -# Just like in polybar. -# Each bar represents amount of load on one core since -# last run. - -# Cache in tmpfs to improve speed and reduce SSD load -cache=/tmp/cpubarscache - -case $BLOCK_BUTTON in - 2) setsid -f "$TERMINAL" -e btop >/dev/null 2>&1 ;; - 3) notify-send "πͺ¨ CPU load module" "Each bar represents -one CPU core";; - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; -esac - -# id total idle -stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat) -[ ! -f $cache ] && echo "$stats" > "$cache" -old=$(bat "$cache") -printf "πͺ¨" -echo "$stats" | while read -r row; do - id=${row%% *} - rest=${row#* } - total=${rest%% *} - idle=${rest##* } - - case "$(echo "$old" | awk '{if ($1 == id) - printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \ - id="$id" total="$total" idle="$idle")" in - - "0") printf "β";; - "1") printf "β";; - "2") printf "β";; - "3") printf "β";; - "4") printf "β
";; - "5") printf "β";; - "6") printf "β";; - "7") printf "β";; - "8") printf "β";; - esac -done; printf "\\n" -echo "$stats" > "$cache" diff --git a/.local/bin/statusbar/sb-disk b/.local/bin/statusbar/sb-disk deleted file mode 100755 index adfa0e3..0000000 --- a/.local/bin/statusbar/sb-disk +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# Status bar module for disk space -# $1 should be drive mountpoint, otherwise assumed /. - -location=${1:-/} - -[ -d "$location" ] || exit - -case $BLOCK_BUTTON in - 1) notify-send "π½ Disk space" "$(df -h --output=target,used,size)" ;; - 3) notify-send "π½ Disk module" "\- Shows used hard drive space. -- Click to show all disk info." ;; - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; -esac - -case "$location" in - "/home"* ) icon="π " ;; - "/mnt"* ) icon="πΎ" ;; - *) icon="π₯";; -esac - -printf "%s: %s\n" "$icon" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')" diff --git a/.local/bin/statusbar/sb-iplocate b/.local/bin/statusbar/sb-iplocate deleted file mode 100755 index a993207..0000000 --- a/.local/bin/statusbar/sb-iplocate +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/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/ - -set -e - -ifinstalled "geoip" -addr="$(geoiplookup "$(curl -sfm 1 ifconfig.me 2>/dev/null)")" -name="${addr##*, }" -flag="$(rg "flag: $name" "${XDG_DATA_HOME:-$HOME/.local/share}/extras/emoji")" -flag="${flag%% *}" -printf "%s %s\\n" "$flag" "$name" diff --git a/.local/bin/statusbar/sb-kbselect b/.local/bin/statusbar/sb-kbselect deleted file mode 100755 index f4d3e9e..0000000 --- a/.local/bin/statusbar/sb-kbselect +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# works on any init system -# requirements: mew - -kbquery() -{ - kblayout=$(swaymsg --raw -t get_inputs | jq -r '.[] | select(.type == "keyboard") | .xkb_active_layout_name' | sort -u) || exit 1 - kblayout=$(echo "$kblayout" | sed 's/(/\\(/g; s/)/\\)/g') || exit 1 - kblayout=$(rg -oP "^\s*\K\w+(?=\s+$kblayout)" /usr/share/X11/xkb/rules/base.lst) || exit 1 - echo $kblayout -} - -kb=$(kbquery) - -case $BLOCK_BUTTON in - 1) kb_choice="$(awk '/! layout/{flag=1; next} /! variant/{flag=0} flag {print $2, "- " $1}' /usr/share/X11/xkb/rules/base.lst | mew -l 15)" - [ -z "$kb_choice" ] && exit 0 - kb="$(echo "$kb_choice" | awk '{print $3}')" - swaymsg input "type:keyboard" xkb_layout "$kb" >/dev/null 2>&1 - pkill -RTMIN+30 "${STATUSBAR:-waybar}";; - 3) notify-send "β¨ Keyboard/language module" "$(printf "%s" "\- Current layout: $(kbquery)") -- Left click to change keyboard.";; - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; -esac - -echo "$kb" diff --git a/.local/bin/statusbar/sb-mailbox b/.local/bin/statusbar/sb-mailbox deleted file mode 100755 index 19478e8..0000000 --- a/.local/bin/statusbar/sb-mailbox +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -# Displays number of unread mail and an loading icon if updating. -# When clicked, brings up `neomutt`. - -case $BLOCK_BUTTON in - 1) setsid -w -f "$TERMINAL" -e neomutt ; pkill -RTMIN+12 "${STATUSBAR:-waybar}" ;; - 2) setsid -f mailup >/dev/null && exit ;; - 3) notify-send "ο― Mail module" "\- Shows unread mail -- Shows ο‘ if syncing mail -- Left click opens neomutt -- Middle click syncs mail" ;; - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; -esac - -unread="$(fd . "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/ -t f | wc -l 2>/dev/null)" - -icon=$(bat /tmp/mailupdate 2>/dev/null) - -if [ "$unread" -eq 0 ]; then - [ -n "$icon" ] && echo "ο―$icon" || exit 0 -else - echo "ο― $unread$icon" -fi diff --git a/.local/bin/statusbar/sb-memory b/.local/bin/statusbar/sb-memory deleted file mode 100755 index e031e3e..0000000 --- a/.local/bin/statusbar/sb-memory +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -case $BLOCK_BUTTON in - 1) notify-send "ξΏ
Memory hogs" "$(ps axch -o cmd,%mem | awk '{cmd[$1]+=$2} END {for (i in cmd) print i, cmd[i]}' | sort -nrk2 | head)" ;; - 2) setsid -f "$TERMINAL" -e btop >/dev/null 2>&1 ;; - 3) notify-send "ξΏ
Memory module" "\- Shows Memory Used/Total. -- Click to show memory hogs. -- Middle click to open btop." ;; - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; -esac - -used=$(free --mebi | sed -n '2{p;q}' | awk '{print $3}') -total=$(free --mebi | sed -n '2{p;q}' | awk '{print $2}') - -usage_percentage=$((100 * used / total)) - -# case 1 in -# $((usage_percentage >= 87)) ) icon="β "; class="high" ;; -# $((usage_percentage >= 70)) ) icon="β "; class="high" ;; -# $((usage_percentage >= 62)) ) icon="β "; class="mid" ;; -# $((usage_percentage >= 50)) ) icon="β
"; class="mid" ;; -# $((usage_percentage >= 37)) ) icon="β "; class="mid" ;; -# $((usage_percentage >= 25)) ) icon="β "; class="low" ;; -# $((usage_percentage >= 12)) ) icon="β "; class="low" ;; -# $((usage_percentage >= 0)) ) icon="β "; class="low" ;; -# * ) echo unavailable && exit ;; -# esac - -output="$icon${used}MB" - -printf '{"text": "%s", "class": "%s" }' "$output" "$class" diff --git a/.local/bin/statusbar/sb-microphone b/.local/bin/statusbar/sb-microphone deleted file mode 100755 index 370c223..0000000 --- a/.local/bin/statusbar/sb-microphone +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh - -# Prints the current microphone volume or ο± if muted. - -case $BLOCK_BUTTON in - 1) setsid -w -f "$TERMINAL" -e pulsemixer; pkill -RTMIN+23 "${STATUSBAR:-waybar}" ;; - 2) wpctl set-mute @DEFAULT_SOURCE@ toggle ;; - 4) wpctl set-volume @DEFAULT_SOURCE@ 1%+ ;; - 5) wpctl set-volume @DEFAULT_SOURCE@ 1%- ;; - 3) notify-send "σ°¬ Microphone volume module" "\- Shows volume σ°¬, ο± if muted. -- Middle click to mute. -- Scroll to change." ;; - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; -esac - -vol="$(wpctl get-volume @DEFAULT_AUDIO_SOURCE@)" - -# If muted, print ο± and exit. -[ "$vol" != "${vol%\[MUTED\]}" ] && echo ο± && exit - -vol="${vol#Volume: }" - -split() { - # For ommiting the . without calling and external program. - IFS=$2 - set -- $1 - printf '%s' "$@" -} - -vol="$(printf "%.0f" "$(split "$vol" ".")")" - -case 1 in - $((vol >= 70)) ) icon="ο° " ;; - $((vol >= 30)) ) icon="ο° " ;; - $((vol >= 1)) ) icon="ο° " ;; - * ) echo ο± && exit ;; -esac - -echo "$icon$vol%" diff --git a/.local/bin/statusbar/sb-moonphase b/.local/bin/statusbar/sb-moonphase deleted file mode 100755 index f91a751..0000000 --- a/.local/bin/statusbar/sb-moonphase +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -# Shows the current moon phase. - -moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase" - -[ -s "$moonfile" ] && [ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || - { curl -sf "wttr.in/?format=%m" > "$moonfile" || exit 1 ;} - -icon="$(bat "$moonfile")" - -case "$icon" in - π) name="New" ;; - π) name="Waxing Crescent" ;; - π) name="First Quarter" ;; - π) name="Waxing Gibbous" ;; - π) name="Full" ;; - π) name="Waning Gibbous" ;; - π) name="Last Quarter" ;; - π) name="Waning Crescent" ;; - *) exit 1 ;; -esac - -echo "${icon-?}" - -case $BLOCK_BUTTON in - 3) notify-send "π Moon phase module" "Displays current moon phase. -- π: New -- π: Waxing Crescent -- π: First Quarter -- π: Waxing Gibbous -- π: Full -- π: Waning Gibbous -- π: Last Quarter -- π: Waning Crescent" ;; - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; -esac diff --git a/.local/bin/statusbar/sb-music b/.local/bin/statusbar/sb-music deleted file mode 100755 index f144762..0000000 --- a/.local/bin/statusbar/sb-music +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -AWK_FILTER=' -NR==1 { - if ($0 ~ /volume:/) { print ""; exit } - artist_track = $0 - next -} -NR>1 { - if ($0 ~ /\[paused\]/) status_icon = "ο " - if ($0 ~ /\[playing\]/) status_icon = "" - if ($0 ~ /consume: on/) modes = modes "ο " - if ($0 ~ /random: on/) modes = modes "ο΄ " - if ($0 ~ /repeat: on/) modes = modes "ο " - if ($0 ~ /single: on/) modes = modes "ο1 " -} -END { - sub(/[[:space:]]+$/, "", modes) - if (artist_track) { - if (modes) print status_icon artist_track " | " modes - else print status_icon artist_track - } else print "" -} -' - -pidof -x sb-mpdup >/dev/null 2>&1 || sb-mpdup >/dev/null 2>&1 & - -case $BLOCK_BUTTON in - 1) mpc status | awk "$AWK_FILTER" ; setsid -f "$TERMINAL" -e rmpc >/dev/null 2>&1 < /dev/null;; - 2) mpc toggle | awk "$AWK_FILTER" ;; - 3) mpc status | awk "$AWK_FILTER" ; notify-send "ο Music module" "\ -- Shows mpd song playing. -- ο paused. -- ο consume mode. -- ο΄ shuffle mode. -- ο repeat mode. -- ο1 single mode. -- Left click opens rmpc. -- Middle click pauses. -- Scroll changes track.";; - 4) mpc prev | awk "$AWK_FILTER" ;; - 5) mpc next | awk "$AWK_FILTER" ;; - 8) mpc status | awk "$AWK_FILTER" ; setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 < /dev/null ;; - *) mpc status | awk "$AWK_FILTER" ;; -esac diff --git a/.local/bin/statusbar/sb-nettraf b/.local/bin/statusbar/sb-nettraf deleted file mode 100755 index 8921123..0000000 --- a/.local/bin/statusbar/sb-nettraf +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -# Module showing network traffic. Shows how much data has been received (RX) or -# transmitted (TX) since the previous time this script ran. So if run every -# second, gives network traffic per second. - -case $BLOCK_BUTTON in - 3) notify-send "π Network traffic module" "π»: Traffic received -πΊ: Traffic transmitted" ;; - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; -esac - -update() { - sum=0 - for arg; do - read -r i < "$arg" - sum=$(( sum + i )) - done - cache=/tmp/${1##*/} - [ -f "$cache" ] && read -r old < "$cache" || old=0 - printf %d\\n "$sum" > "$cache" - printf %d\\n $(( sum - old )) -} - -rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes) -tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes) - -printf "π»%4sB πΊ%4sB\\n" $(numfmt --to=iec $rx $tx) diff --git a/.local/bin/statusbar/sb-pacpackages b/.local/bin/statusbar/sb-pacpackages deleted file mode 100755 index 5ef09d3..0000000 --- a/.local/bin/statusbar/sb-pacpackages +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -# 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. -# -# Add the following text as a file in /usr/share/libalpm/hooks/statusbar.hook: -# -# [Trigger] -# Operation = Upgrade -# Type = Package -# Target = * -# -# [Action] -# Description = Updating statusbar... -# When = PostTransaction -# Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3. - -case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e sb-popupgrade >/dev/null 2>&1 ;; - 2) notify-send "$(/usr/bin/pacman -Qu)" ;; - 3) notify-send "σ°° Upgrade module" "οΉ: number of upgradable packages -- Left click to upgrade packages -- Middle click to show upgradable packages" ;; - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; -esac - -pacman -Qu | rg -Fcv "[ignored]" | sed "s/^/οΉ /;s/^οΉ 0$//g" diff --git a/.local/bin/statusbar/sb-popupgrade b/.local/bin/statusbar/sb-popupgrade deleted file mode 100755 index 94279c8..0000000 --- a/.local/bin/statusbar/sb-popupgrade +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -printf "Beginning upgrade.\\n" - -paru -pkill -RTMIN+8 "${STATUSBAR:-waybar}" - -printf "\\nUpgrade complete.\\nPress <Enter> to exit window.\\n\\n" -read -r _ diff --git a/.local/bin/statusbar/sb-price b/.local/bin/statusbar/sb-price deleted file mode 100755 index d320511..0000000 --- a/.local/bin/statusbar/sb-price +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh - -# Usage: -# price <currency-base currency> <name of currency> <icon> <signal> -# price bat-btc "Basic Attention Token" π¦ 24 -# This will give the price of BAT denominated in BTC and will update on -# signal 24. -# When the name of the currency is multi-word, put it in quotes. - -[ -z "$1" ] && exit 1 - -url="${CRYPTOURL:-rate.sx}" -target="${1%%-*}" -denom="${1##*-}" -name="${2:-$1}" -icon="${3:-π°}" -case "$denom" in - "$target"|usd) denom="usd"; symb="$" ;; - gbp) symb="Β£" ;; - eur) symb="β¬" ;; - rub) symb="β½" ;; - btc) symb="ο
" ;; -esac -interval="@14d" # History contained in chart preceded by '@' (7d = 7 days) -dir="${XDG_CACHE_HOME:-$HOME/.cache}/crypto-prices" -pricefile="$dir/$target-$denom" -chartfile="$dir/$target-$denom-chart" -filestat="$(stat -c %y "$pricefile" 2>/dev/null)" - -[ -d "$dir" ] || mkdir -p "$dir" - -updateprice() { curl -sf \ - --fail-early "${denom}.${url}/1${target}" "${denom}.${url}/${target}${interval}" \ - --output "$pricefile" --output "$chartfile" || - rm -f "$pricefile" "$chartfile" ;} - -[ "${filestat%% *}" != "$(date '+%Y-%m-%d')" ] && - updateme="1" - -case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e less -Srf "$chartfile" >/dev/null ;; - 2) notify-send -u low "$icon Updating..." "Updating $name price..." ; updateme="1" ; showupdate="1" ;; - 3) uptime="$(date -d "$filestat" '+%D at %T' | sed "s|$(date '+%D')|Today|")" - notify-send "$icon $name module" "\- <b>Exact price: $symb$(bat "$pricefile")</b> -- Left click for chart of changes. -- Middle click to update. -- Shows π if updating prices. -- <b>Last updated: -$uptime</b>" ;; - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null ;; -esac - -[ -n "$updateme" ] && - updateprice "$target" && - [ -n "$showupdate" ] && - notify-send "$icon Update complete." "$name price is now -$symb$(bat "$pricefile")" - -[ -f "$pricefile" ] && printf "%s%s%0.2f\n" "$icon" "$symb" "$(bat "$pricefile")" diff --git a/.local/bin/statusbar/sb-tasks b/.local/bin/statusbar/sb-tasks deleted file mode 100755 index 14778a2..0000000 --- a/.local/bin/statusbar/sb-tasks +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# Originally by Andr3as07 <https://github.com/Andr3as07> -# Some changes by Luke -# Rebuild by Tenyun - -# This block displays the number running background tasks. Requires tsp. - -num=$(tsp -l | awk -v numr=0 -v numq=0 '{if (/running/)numr++; if (/queued/)numq++} END{print numr+numq"("numq")"}') - -# Handle mouse clicks -case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e tsp -l >/dev/null 2>&1 ;; - 3) notify-send "Tasks module" "π€: number of running/queued background tasks -- Left click opens tsp" ;; # Right click - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; -esac - -[ "$num" != "0(0)" ] && - echo "π€$num" diff --git a/.local/bin/statusbar/sb-ticker b/.local/bin/statusbar/sb-ticker deleted file mode 100755 index 5b26160..0000000 --- a/.local/bin/statusbar/sb-ticker +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -# Usage -# sb-ticker -# Sample output -# ^DJI: 0.09% -# CL=F: -1.88% -# Description -# displays/retrieves the latest percent-change in stock market quotes listed in $XDG_CONFIG_HOME/tickers. -# defaults to S&P 500, Dow Jones Industrial, and the Nasdaq -# -# intended to be used in the statusbar, which will display the first quote price in the output - -url="terminal-stocks.dev" -pricefile="${XDG_CACHE_HOME:-$HOME/.cache}/stock-prices" -tickerfile="${XDG_CONFIG_HOME:-$HOME/.config}/tickers" - -[ -f "$tickerfile" ] && tickers="$(bat "$tickerfile")" || tickers="^GSPC,^DJI,^IXIC"; - -checkprice() { - [ -s "$pricefile" ] && [ "$(stat -c %y "$pricefile" 2>/dev/null | - cut -d':' -f1)" != "$(date '+%Y-%m-%d %H')" ] -} - -getchange() { - mapfile -t changes < <(sed -e 's/ / /g' "$pricefile" | rg -oe '[m-]\+[0-9]\+\.[0-9]\+' | sed 's/[m ]/;/g') - IFS=',' read -ra TICKER <<< "$tickers" - for idx in "${!TICKER[@]}"; do - printf "%s: %s%%\n" "${TICKER[$idx]}" "${changes[$idx]//;/}" - done -} - -updateprice() { curl -sfm 10 "$url/$tickers" --output "$pricefile" || rm -f "$pricefile" ; } - -case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e less -Srf "$pricefile" >/dev/null 2>&1 ;; - 2) notify-send -u low "Updating..." "Updating prices" ; updateme="1" ;; - 3) notify-send "Current prices:" "Current stock prices:\n<b>$(getchange)</b> -- Left click to show price file -- Middle click to update stock prices -- Right click to get stock overview" ;; - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; -esac - -[ -n "$updateme" ] && updateprice - -[ -f "$pricefile" ] && getchange - -checkprice && updateprice diff --git a/.local/bin/statusbar/sb-torrent b/.local/bin/statusbar/sb-torrent deleted file mode 100755 index 8415b25..0000000 --- a/.local/bin/statusbar/sb-torrent +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -transmission-remote -l | rg % | - sed " # The letters are for sorting and will not appear. -s/.*Stopped.*/A ο/; -s/.*Seeding.*/Z ξΆ§/; -s/.*100%.*/N ο
/; -s/.*Idle.*/B ο/; -s/.*Uploading.*/L ο’/; -s/.*%.*/M ο£/" | - sort -h | uniq -c | awk '{print $3 $1}' | paste -sd ' ' - - -case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e stig >/dev/null 2>&1 ;; - 2) td-toggle ;; - 3) notify-send "ξΆ§ Torrent module" "\- Left click to open stig. -- Middle click to toggle transmission. -- Shift click to edit script. -Module shows number of torrents: -ο: paused -ο: idle (seeds needed) -ο’: uploading (unfinished) -ο£: downloading -ο
: done -ξΆ§: done and seeding" ;; - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; -esac diff --git a/.local/bin/statusbar/sb-volume b/.local/bin/statusbar/sb-volume deleted file mode 100755 index 7a5bc42..0000000 --- a/.local/bin/statusbar/sb-volume +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh - -# Prints the current volume or  if muted. - -case $BLOCK_BUTTON in - 1) setsid -w -f "$TERMINAL" -e pulsemixer; pkill -RTMIN+10 "${STATUSBAR:-waybar}" ;; - 2) wpctl set-mute @DEFAULT_SINK@ toggle ;; - 4) wpctl set-volume @DEFAULT_SINK@ 1%+ ;; - 5) wpctl set-volume @DEFAULT_SINK@ 1%- ;; - 3) notify-send "ο¨ Volume module" "\- Shows volume ο¨,  if muted. -- Middle click to mute. -- Scroll to change." ;; - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; -esac - -vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" - -# If muted, print  and exit. -[ "$vol" != "${vol%\[MUTED\]}" ] && echo  && exit - -vol="${vol#Volume: }" - -split() { - # For ommiting the . without calling and external program. - IFS=$2 - set -- $1 - printf '%s' "$@" -} - -vol="$(printf "%.0f" "$(split "$vol" ".")")" - -case 1 in - $((vol >= 70)) ) icon="ο¨ " ;; - $((vol >= 30)) ) icon="ο§ " ;; - $((vol >= 1)) ) icon="ο¦ " ;; - * ) echo  && exit ;; -esac - -echo "$icon$vol%" diff --git a/.local/bin/statusbar/sb-weather b/.local/bin/statusbar/sb-weather deleted file mode 100755 index dfaad4b..0000000 --- a/.local/bin/statusbar/sb-weather +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/sh -arg=$1 -report=~/.cache/weather_report.json - -ifinstalled jq - -# Get a weather report from 'wttr.in' and save it locally. -getforecast() { { rg -q -m1 '^up$' /sys/class/net/w*/operstate || rg -q -m1 '^up$' /sys/class/net/e*/operstate; } && - curl -sf "wttr.in/?format=j1" --output "$report" && touch "$report" -} - -# Forecast should be updated only once a day. -checkforecast() { - [ "$(stat -c %y "$report" 2>/dev/null | - cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] -} - -# Function to get weather emoji from code -get_weather_emoji() { - local code="$1" - grep "^$code " ~/.local/share/extras/weather_codes | awk '{print $2}' -} - -showweather(){ - temp=$(jq -r '.current_condition[0].temp_C' $report) - code=$(jq -r '.current_condition[0].weatherCode' $report) - rainchance=$(jq '.weather[].hourly[].chanceofrain | tonumber' $report | sort -n | tail -n 1) - - emoji=$(get_weather_emoji "$code") - case "$arg" in - weather) - case 1 in - $((temp >= 30)) ) class="very_hot" ;; - $((temp >= 26)) ) class="hot" ;; - $((temp >= 21)) ) class="warm" ;; - $((temp >= 16)) ) class="mild" ;; - $((temp >= 11)) ) class="cool" ;; - $((temp >= 6)) ) class="chilly" ;; - $((temp >= 0)) ) class="cold" ;; - $((temp < 0)) ) class="below_zero" ;; - * ) echo unavailable && exit ;; - esac - output="$emoji$tempΒ°C" - ;; - rain) - case 1 in - $((rainchance >= 70)) ) class="high" ;; - $((rainchance >= 45)) ) class="mid" ;; - $((rainchance > 0)) ) class="low" ;; - $((rainchance <= 0)) ) printf '' && exit ;; - * ) echo unavailable && exit ;; - esac - output="ο©$rainchance%" - ;; - *) - echo "Usage: $0 {weather|rain}" - exit 1 - ;; - esac - printf '{"text": "%s", "class": "%s" }' "$output" "$class" -} - -case $BLOCK_BUTTON in - 2) getforecast && showweather ;; - 3) notify-send "ξ¦ Weather module" "\- Middle click to update forecast. -ο©: Chance of rain/snow -ο’: Current temperature" ;; - 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; -esac - -# shellcheck disable=SC2015 -checkforecast && showweather || - ( flock -n 9 && - ( tries=0; while [ $tries -ne 100 ]; do - getforecast && break || - { tries=$((tries+1)); sleep .1; } - done - ! checkforecast && - until getforecast; do sleep 60; done - pkill -RTMIN+5 "${STATUSBAR:-waybar}" - ) & - echo ) 9>"${XDG_RUNTIME_DIR}/sb-forecast.lock" |