From 60052659b98832c78c902e4f27ecee2663d8e913 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Wed, 6 May 2026 08:30:49 +0200 Subject: Added scripts --- scripts/status-linux | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 scripts/status-linux (limited to 'scripts/status-linux') diff --git a/scripts/status-linux b/scripts/status-linux new file mode 100755 index 0000000..a2061d1 --- /dev/null +++ b/scripts/status-linux @@ -0,0 +1,52 @@ +#!/bin/sh + +# Prints some status info to stdout. Includes: +# - date and time +# - battery +# - wifi (requires nmcli) +# - past notifications (requires notify) + +# Usage: status [separator] + +sep=${1:-" | "} + +time=$(date +"%H:%M") +date=$(date +"%a %d %b") + +if [ "$(pulsemixer --get-mute)" -eq 1 ]; then + volume="Muted" +else + volume="Vol $(pulsemixer --get-volume | awk '{print $1}')%" +fi + +bat="/sys/class/power_supply/BAT0" +if [ -d $bat ]; then + charge_status="$(cat $bat/status | awk '{print substr ($0, 0, 2)}')" + battery="Bat $(cat $bat/capacity)% $charge_status" +else + battery="No battery" +fi + +# NetworkManager has a dreadful command line interface +# It makes cry every time +# pls help +#nwline="$(nmcli device status | head -n 2 | tail -n 1)" +#nwclean="$(echo "$nwline" | sed 's/ *$//' | sed 's/.* //')" +#network="Network: $nwclean" + +# Thank you iwctl for saving us from this dreadful existence +network="$(iwctl station wlan0 show | grep 'Connected network' | awk '{print $3}')" +if [ "$(cat /sys/class/net/eth0/carrier)" = 1 ]; then + if [ -z "$network" ]; then + network="eth" + else + network="eth & $network" + fi +fi + +noticount=$(notify show | wc -l) + +printf '%s' "$network$sep$volume$sep$battery$sep$date$sep$time" +[ "$noticount" = "1" ] && printf '%s' "$sep$(notify show)" +[ "$noticount" -gt "1" ] && printf '%s' "${sep}[$noticount]" +printf '\n' -- cgit v1.3