summaryrefslogtreecommitdiff
path: root/scripts/status-linux
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2026-05-06 08:30:49 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2026-05-06 08:30:49 +0200
commit60052659b98832c78c902e4f27ecee2663d8e913 (patch)
tree9efc1388569c43456557aa1975b4bec99bf06c94 /scripts/status-linux
parent10e16c2fb2266bb2b46ec7ea64d721de0c29a0d9 (diff)
downloadconfig-60052659b98832c78c902e4f27ecee2663d8e913.tar.gz
config-60052659b98832c78c902e4f27ecee2663d8e913.zip
Added scripts
Diffstat (limited to 'scripts/status-linux')
-rwxr-xr-xscripts/status-linux52
1 files changed, 52 insertions, 0 deletions
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 @@
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
11sep=${1:-" | "}
12
13time=$(date +"%H:%M")
14date=$(date +"%a %d %b")
15
16if [ "$(pulsemixer --get-mute)" -eq 1 ]; then
17 volume="Muted"
18else
19 volume="Vol $(pulsemixer --get-volume | awk '{print $1}')%"
20fi
21
22bat="/sys/class/power_supply/BAT0"
23if [ -d $bat ]; then
24 charge_status="$(cat $bat/status | awk '{print substr ($0, 0, 2)}')"
25 battery="Bat $(cat $bat/capacity)% $charge_status"
26else
27 battery="No battery"
28fi
29
30# NetworkManager has a dreadful command line interface
31# It makes cry every time
32# pls help
33#nwline="$(nmcli device status | head -n 2 | tail -n 1)"
34#nwclean="$(echo "$nwline" | sed 's/ *$//' | sed 's/.* //')"
35#network="Network: $nwclean"
36
37# Thank you iwctl for saving us from this dreadful existence
38network="$(iwctl station wlan0 show | grep 'Connected network' | awk '{print $3}')"
39if [ "$(cat /sys/class/net/eth0/carrier)" = 1 ]; then
40 if [ -z "$network" ]; then
41 network="eth"
42 else
43 network="eth & $network"
44 fi
45fi
46
47noticount=$(notify show | wc -l)
48
49printf '%s' "$network$sep$volume$sep$battery$sep$date$sep$time"
50[ "$noticount" = "1" ] && printf '%s' "$sep$(notify show)"
51[ "$noticount" -gt "1" ] && printf '%s' "${sep}[$noticount]"
52printf '\n'

Generated with cgit - Back to sebastiano.tronto.net