aboutsummaryrefslogtreecommitdiff
path: root/status-void
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-09-15 20:16:50 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-09-15 20:16:50 +0200
commit818acc5e752efeabaea46b6c5e60cb5bcbb7412b (patch)
tree98db970558b811cede2da7467b182b055e40748c /status-void
parent706e50ace71471192d304f873ad058a638285a9a (diff)
parenta75c732b88bd27e351368b1a7b0c111df5488be1 (diff)
downloadscripts-818acc5e752efeabaea46b6c5e60cb5bcbb7412b.tar.gz
scripts-818acc5e752efeabaea46b6c5e60cb5bcbb7412b.zip
Merge branch 'master' of tronto.net:scripts
Diffstat (limited to 'status-void')
-rwxr-xr-xstatus-void41
1 files changed, 41 insertions, 0 deletions
diff --git a/status-void b/status-void
new file mode 100755
index 0000000..fcc4c28
--- /dev/null
+++ b/status-void
@@ -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
11sep=${1:-" | "}
12
13time=$(date +"%H:%M")
14date=$(date +"%d %B %Y, %A")
15
16if [ "$(pulsemixer --get-mute)" -eq 1 ]; then
17 volume="Audio muted"
18else
19 volume="Volume: $(pulsemixer --get-volume | awk '{print $1}')%"
20fi
21
22bat="/sys/class/power_supply/BAT0"
23if [ -d $bat ]; then
24 battery="Battery: $(cat $bat/capacity)% $(cat $bat/status)"
25else
26 battery="No battery"
27fi
28
29# NetworkManager has a dreadful command line interface
30# It makes cry every time
31# pls help
32nwline="$(nmcli device status | head -n 2 | tail -n 1)"
33nwclean="$(echo "$nwline" | sed 's/ *$//' | sed 's/.* //')"
34network="Network: $nwclean"
35
36noticount=$(notify show | wc -l)
37
38printf '%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"
41printf '\n'

Generated with cgit - Back to sebastiano.tronto.net