diff options
author | marlonivo <email@marlonivo.xyz> | 2025-04-14 10:21:23 +0000 |
---|---|---|
committer | marlonivo <email@marlonivo.xyz> | 2025-04-14 10:21:23 +0000 |
commit | 4e3440c77a5e3a9f09d1719e2e8782500e3a5415 (patch) | |
tree | 25c2b34cc9a73043adb888d33745f473e5ed41d5 /.local/bin/statusbar | |
parent | 0d1a84f59d8cdd62c97410f96f8a13c98c51453a (diff) |
Diffstat (limited to '.local/bin/statusbar')
-rwxr-xr-x | .local/bin/statusbar/sb-battery | 37 | ||||
-rw-r--r-- | .local/bin/statusbar/sb-bluetooth [TODO] | 0 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-clock | 33 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-cpu | 12 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-cpubars | 44 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-disk | 23 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-help-icon | 20 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-internet | 33 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-kbselect | 17 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-mailbox [TODO] | 20 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-memory | 13 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-mpdup | 8 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-music [TODO] | 19 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-news | 17 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-pacpackages | 29 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-popupgrade | 9 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-tasks [TODO] | 16 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-volume | 39 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-write | 20 |
19 files changed, 0 insertions, 409 deletions
diff --git a/.local/bin/statusbar/sb-battery b/.local/bin/statusbar/sb-battery deleted file mode 100755 index 79030bc..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 ;; - 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; -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 "$(cat "$battery/status" 2>&1)" in - "Full") status="β‘" ;; - "Discharging") status="π" ;; - "Charging") status="π" ;; - "Not charging") status="π" ;; - "Unknown") status="β»οΈ" ;; - *) exit 1 ;; - esac - capacity="$(cat "$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-bluetooth [TODO] b/.local/bin/statusbar/sb-bluetooth [TODO] deleted file mode 100644 index e69de29..0000000 --- a/.local/bin/statusbar/sb-bluetooth [TODO] +++ /dev/null diff --git a/.local/bin/statusbar/sb-clock b/.local/bin/statusbar/sb-clock deleted file mode 100755 index 572f99d..0000000 --- a/.local/bin/statusbar/sb-clock +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -# If you relocate you have to manually change the timezone -export TZ=Europe/Berlin - -clock=$(date '+%I') - -case "$clock" in - "00") icon="π" ;; - "01") icon="π" ;; - "02") icon="π" ;; - "03") icon="π" ;; - "04") icon="π" ;; - "05") icon="π" ;; - "06") icon="π" ;; - "07") icon="π" ;; - "08") icon="π" ;; - "09") icon="π" ;; - "10") icon="π" ;; - "11") icon="π" ;; - "12") icon="π" ;; -esac - -case $BLOCK_BUTTON in - 1) notify-send "This Month" "$(cal | sed "s/\<$(date +'%e')\>/<b><span color='red'>&<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;; - 2) setsid -f "$TERMINAL" -e calcurse ;; - 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" ;; - 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -# Ausgabe der Zeit ohne Emoji -date "+%Y %b %d %a | %I:%M%p" diff --git a/.local/bin/statusbar/sb-cpu b/.local/bin/statusbar/sb-cpu deleted file mode 100755 index 85e52c8..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:15,%cpu --sort=-%cpu | head)\\n(100% per core)" ;; - 2) setsid -f "$TERMINAL" -e htop ;; - 3) notify-send "π₯ CPU module " "\- Shows CPU temperature. -- Click to show intensive processes. -- Middle click to open htop." ;; - 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; -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 4015893..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 htop ;; - 3) notify-send "πͺ¨ CPU load module" "Each bar represents -one CPU core";; - 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; -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=$(cat "$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 7f3ff79..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." ;; - 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; -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-help-icon b/.local/bin/statusbar/sb-help-icon deleted file mode 100755 index 051f663..0000000 --- a/.local/bin/statusbar/sb-help-icon +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# Das anklickbare HilfemenΓΌ. Mittelklick, um den Fenstermanager neu zu starten. - -# ΓberprΓΌfe, ob dwm lΓ€uft, verwende dwm's Readme und starte neu. -if pidof dwm >/dev/null; then - READMEFILE="/home/artix/.config/sharks/commands.md" - restartwm() { pkill -HUP dwm ;} -else - restartwm() { i3 restart ;} -fi - -case $BLOCK_BUTTON in - 1) typora "${READMEFILE:-${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.md}" ;; - 2) restartwm ;; - 3) notify-send "β Shortcutkeys" ;; - 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -echo "β" diff --git a/.local/bin/statusbar/sb-internet b/.local/bin/statusbar/sb-internet deleted file mode 100755 index f94447d..0000000 --- a/.local/bin/statusbar/sb-internet +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -# Show wifi πΆ and percent strength or π‘ if none. -# Show π if connected to ethernet or β if none. -# Show π if a vpn connection is active - -case $BLOCK_BUTTON in - 1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;; - 3) notify-send "π Internet module" "\- Click to connect -β: wifi disabled -π‘: no wifi connection -πΆ: wifi connection with quality -π: no ethernet -π: ethernet working -π: vpn is active -" ;; - 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -# Wifi -if [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ] ; then - wifiicon="$(awk '/^\s*w/ { print "πΆ", int($3 * 100 / 70) "% " }' /proc/net/wireless)" -elif [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'down' ] ; then - [ "$(cat /sys/class/net/w*/flags 2>/dev/null)" = '0x1003' ] && wifiicon="π‘ " || wifiicon="β " -fi - -# Ethernet -[ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && ethericon="π" || ethericon="π" - -# TUN -[ -n "$(cat /sys/class/net/tun*/operstate 2>/dev/null)" ] && tunicon=" π" - -printf "%s%s%s\n" "$wifiicon" "$ethericon" "$tunicon" diff --git a/.local/bin/statusbar/sb-kbselect b/.local/bin/statusbar/sb-kbselect deleted file mode 100755 index 2c58325..0000000 --- a/.local/bin/statusbar/sb-kbselect +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# works on any init system -# requirements: dmenu, xorg-setxkbmap -kb="β¨οΈ" || exit 1 - -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 | dmenu -l 15)" - [ -z "$kb_choice" ] && exit 0 - kb="$(echo "$kb_choice" | awk '{print "β¨οΈ"}')" - setxkbmap "$(echo "$kb_choice" | awk '{print $3}')" - pkill -RTMIN+30 "${STATUSBAR:-dwmblocks}";; - 3) notify-send "β¨ Keyboard/language module" "$(printf "%s" "\- Current layout: $(setxkbmap -query | grep -oP 'layout:\s*\K\w+')") -- Left click to change keyboard.";; - 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -echo "$kb" diff --git a/.local/bin/statusbar/sb-mailbox [TODO] b/.local/bin/statusbar/sb-mailbox [TODO] deleted file mode 100755 index 7483aa4..0000000 --- a/.local/bin/statusbar/sb-mailbox [TODO] +++ /dev/null @@ -1,20 +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:-dwmblocks}" ;; - 2) setsid -f mw -Y >/dev/null ;; - 3) notify-send "π¬ Mail module" "\- Shows unread mail -- Shows π if syncing mail -- Left click opens neomutt -- Middle click syncs mail" ;; - 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)" - -pidof mbsync >/dev/null 2>&1 && icon="π" - -[ "$unread" = "0" ] && [ "$icon" = "" ] || echo "π¬$unread$icon" diff --git a/.local/bin/statusbar/sb-memory b/.local/bin/statusbar/sb-memory deleted file mode 100755 index 1fe74de..0000000 --- a/.local/bin/statusbar/sb-memory +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -case $BLOCK_BUTTON in - 1) notify-send "π§ Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; - 2) setsid -f "$TERMINAL" -e htop ;; - 3) notify-send "π§ Memory module" "\- Shows Memory Used/Total. -- Click to show memory hogs. -- Middle click to open htop." ;; - 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -free --mebi | sed -n '2{p;q}' | awk '{printf "| %2.2fGiB/%2.2fGiB\n", ($3 / 1024), ($2 / 1024)}' - diff --git a/.local/bin/statusbar/sb-mpdup b/.local/bin/statusbar/sb-mpdup deleted file mode 100755 index af81a7d..0000000 --- a/.local/bin/statusbar/sb-mpdup +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# This loop will update the mpd statusbar module whenever a command changes the -# music player's status. mpd must be running on X's start for this to work. - -while : ; do - mpc idle >/dev/null && kill -45 "$(pidof "${STATUSBAR:-dwmblocks}")" || break -done diff --git a/.local/bin/statusbar/sb-music [TODO] b/.local/bin/statusbar/sb-music [TODO] deleted file mode 100755 index 6734eeb..0000000 --- a/.local/bin/statusbar/sb-music [TODO] +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -filter() { sed "/^volume:/d;s/\\[paused\\].*/βΈ/g;/\\[playing\\].*/d;/^ERROR/Q" | paste -sd ' ' -;} - -pidof -x sb-mpdup >/dev/null 2>&1 || sb-mpdup >/dev/null 2>&1 & - -case $BLOCK_BUTTON in - 1) mpc status | filter ; setsid -f "$TERMINAL" -e ncmpcpp ;; # right click, pause/unpause - 2) mpc toggle | filter ;; # right click, pause/unpause - 3) mpc status | filter ; notify-send "π΅ Music module" "\- Shows mpd song playing. -- βΈ 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 - 6) mpc status | filter ; setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; - *) mpc status | filter ;; -esac diff --git a/.local/bin/statusbar/sb-news b/.local/bin/statusbar/sb-news deleted file mode 100755 index 58ff9a9..0000000 --- a/.local/bin/statusbar/sb-news +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# Displays an icon if updating. -# When clicked, brings up `newsboat`. - -case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e newsboat ;; - 2) setsid -f newsup >/dev/null && exit ;; - 3) notify-send "\- Shows π if updating with \`newsup\` -- Left click opens newsboat -- Middle click syncs RSS feeds -<b>Note:</b> Only one instance of newsboat (including updates) may be running at a time." ;; - 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -# Display update icon if updating, otherwise display nothing. -cat /tmp/newsupdate 2>/dev/null || echo "" diff --git a/.local/bin/statusbar/sb-pacpackages b/.local/bin/statusbar/sb-pacpackages deleted file mode 100755 index 6acdce6..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 ;; - 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" ;; - 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -pacman -Qu | grep -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 51aa48f..0000000 --- a/.local/bin/statusbar/sb-popupgrade +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -printf "Beginning upgrade.\\n" - -yay -Syu --noconfirm -pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}" - -printf "\\nUpgrade complete.\\nPress <Enter> to exit window.\\n\\n" -read -r _ diff --git a/.local/bin/statusbar/sb-tasks [TODO] b/.local/bin/statusbar/sb-tasks [TODO] deleted file mode 100755 index fbee70b..0000000 --- a/.local/bin/statusbar/sb-tasks [TODO] +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# 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 ;; - 3) notify-send "Tasks module" "π€: number of running/queued background tasks -- Left click opens tsp" ;; # Right click - 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -[ "$num" != "0(0)" ] && - echo "π€$num" diff --git a/.local/bin/statusbar/sb-volume b/.local/bin/statusbar/sb-volume deleted file mode 100755 index e66dea7..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:-dwmblocks}" ;; - 2) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;; - 4) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+ ;; - 5) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%- ;; - 3) notify-send "π’ Volume module" "\- Shows volume π, π if muted. -- Middle click to mute. -- Scroll to change." ;; - 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; -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-write b/.local/bin/statusbar/sb-write deleted file mode 100755 index b731626..0000000 --- a/.local/bin/statusbar/sb-write +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# Das anklickbare HilfemenΓΌ. Mittelklick, um den Fenstermanager neu zu starten. - -# ΓberprΓΌfe, ob dwm lΓ€uft, verwende dwm's Readme und starte neu. -if pidof dwm >/dev/null; then - READMEFILE="/home/artix/Files Sync/π Writings/Memoiren/Wer wir sind/Kapitel 1 - Erstes Quartal/βοΈ 1. Kapitel Γbersicht.txt" - restartwm() { pkill -HUP dwm ;} -else - restartwm() { i3 restart ;} -fi - -case $BLOCK_BUTTON in - 1) typora "${READMEFILE:-${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.md}" ;; - 2) restartwm ;; - 3) notify-send "β Shortcutkeys" ;; - 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -echo "write" |