diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-08-15 17:46:28 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-08-15 17:46:28 +0200 |
| commit | acc08eb7aa16d39a598a8bf8631deda1e79ff477 (patch) | |
| tree | 767300e3a8b6a23913946166ae97cd925c7ec569 /status-alpine | |
| parent | 424f6dabb0838f07d7c2ec8a738e5bc6264bf725 (diff) | |
| download | scripts-acc08eb7aa16d39a598a8bf8631deda1e79ff477.tar.gz scripts-acc08eb7aa16d39a598a8bf8631deda1e79ff477.zip | |
Some changes for new system config
Diffstat (limited to 'status-alpine')
| -rwxr-xr-x | status-alpine | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/status-alpine b/status-alpine new file mode 100755 index 0000000..fcc4c28 --- /dev/null +++ b/status-alpine | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # Prints some status info to stdout. Includes: | ||
| 4 | # - date and time | ||
| 5 | # - battery | ||
| 6 | # - wifi (requires nmcli) | ||
| 7 | # - past notifications (requires notify) | ||
| 8 | |||
| 9 | # Usage: status [separator] | ||
| 10 | |||
| 11 | sep=${1:-" | "} | ||
| 12 | |||
| 13 | time=$(date +"%H:%M") | ||
| 14 | date=$(date +"%d %B %Y, %A") | ||
| 15 | |||
| 16 | if [ "$(pulsemixer --get-mute)" -eq 1 ]; then | ||
| 17 | volume="Audio muted" | ||
| 18 | else | ||
| 19 | volume="Volume: $(pulsemixer --get-volume | awk '{print $1}')%" | ||
| 20 | fi | ||
| 21 | |||
| 22 | bat="/sys/class/power_supply/BAT0" | ||
| 23 | if [ -d $bat ]; then | ||
| 24 | battery="Battery: $(cat $bat/capacity)% $(cat $bat/status)" | ||
| 25 | else | ||
| 26 | battery="No battery" | ||
| 27 | fi | ||
| 28 | |||
| 29 | # NetworkManager has a dreadful command line interface | ||
| 30 | # It makes cry every time | ||
| 31 | # pls help | ||
| 32 | nwline="$(nmcli device status | head -n 2 | tail -n 1)" | ||
| 33 | nwclean="$(echo "$nwline" | sed 's/ *$//' | sed 's/.* //')" | ||
| 34 | network="Network: $nwclean" | ||
| 35 | |||
| 36 | noticount=$(notify show | wc -l) | ||
| 37 | |||
| 38 | printf '%s' "$network$sep$volume$sep$battery$sep$date$sep$time" | ||
| 39 | [ "$noticount" = "1" ] && printf '%s' "$sep$(notify show)" | ||
| 40 | [ "$noticount" -gt "1" ] && printf '%s' "${sep}Unread items: $noticount" | ||
| 41 | printf '\n' | ||
