scripts

Various scripts for UNIX-like systems
git clone https://git.tronto.net/scripts
Download | Log | Files | Refs | README

commit 61c59a6c1f356ed23983ad8625d199e4338f1f4d
parent af472eacc1911a37b9db916c4086d817e5cf207c
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Mon, 18 Aug 2025 12:29:59 +0200

Make status bar shorter

Diffstat:
Mnotify | 2+-
Dstatus-alpine | 41-----------------------------------------
Mstatus-linux | 8++++----
3 files changed, 5 insertions(+), 46 deletions(-)

diff --git a/notify b/notify @@ -17,7 +17,7 @@ usage() { touch "$file" case "$1" in push) - echo "(Notified $date) $2" >> "$file" + echo "[$date $2]" >> "$file" $update ;; clean) diff --git a/status-alpine b/status-alpine @@ -1,41 +0,0 @@ -#!/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 +"%d %B %Y, %A") - -if [ "$(pulsemixer --get-mute)" -eq 1 ]; then - volume="Audio muted" -else - volume="Volume: $(pulsemixer --get-volume | awk '{print $1}')%" -fi - -bat="/sys/class/power_supply/BAT0" -if [ -d $bat ]; then - battery="Battery: $(cat $bat/capacity)% $(cat $bat/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" - -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}Unread items: $noticount" -printf '\n' diff --git a/status-linux b/status-linux @@ -11,10 +11,10 @@ sep=${1:-" | "} time=$(date +"%H:%M") -date=$(date +"%d %B %Y, %A") +date=$(date +"%a %d %b") if [ "$(pulsemixer --get-mute)" -eq 1 ]; then - volume="Audio muted" + volume="Muted" else volume="Vol: $(pulsemixer --get-volume | awk '{print $1}')%" fi @@ -35,11 +35,11 @@ fi #network="Network: $nwclean" # Thank you iwctl for saving us from this dreadful existence -network="WiFi: $(iwctl station wlan0 show | grep 'Connected network' | awk '{print $3}')" +network="$(iwctl station wlan0 show | grep 'Connected network' | awk '{print $3}')" 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}Unread items: $noticount" +[ "$noticount" -gt "1" ] && printf '%s' "${sep} [$noticount]" printf '\n'