blob: 8acc18d68192962756255b9b8496e29e4890af87 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#!/bin/sh
get_network_info() {
device=$(ip a | grep "state UP" | awk -F': ' '{ printf($2) }')
case "${device}" in
wlan*)
network=$(iwctl station ${device} show | grep 'Connected network' \
| awk -F' ' '{ printf($3) }')
echo "${device}: ${network}"
;;
eth*)
echo "${device}: ${network}"
;;
esac
}
batperc=$(cat /sys/class/power_supply/BAT0/capacity)
batstate=$(cat /sys/class/power_supply/BAT0/status)
brightness=$(brightnessctl -m | cut -d, -f 4)
volume=$(wpctl get-volume @DEFAULT_SINK@ | awk -F' ' '{ printf "%s %s%% %s", $1, ($2 * 100), $3; }')
network=$(get_network_info)
header="System Info:"
message="\
Date: $(date +"%a %b %d")
Time: $(date "+%I:%M:%S")
${volume}
Brightness: ${brightness}
${batstate}: ${batperc}%
${network}"
if [ "$TERM" = "linux" ]; then
notify-send "$header" "$message"
else
echo "$message"
fi
|