summaryrefslogtreecommitdiff
path: root/scripts/sysinfo
diff options
context:
space:
mode:
authorJack Jamison <jackqjamison@gmail.com>2026-05-05 21:53:16 -0400
committerJack Jamison <jackqjamison@gmail.com>2026-05-05 21:53:16 -0400
commitbe8c956b0e819f2db0c6ae3598b6590b62982a83 (patch)
tree9de8204882f8894776bd34f83af2800130bb87b5 /scripts/sysinfo
parent6ad4d3dfd32b569f9485d24f80a768ed3ca19e46 (diff)
been a while
Diffstat (limited to 'scripts/sysinfo')
-rwxr-xr-xscripts/sysinfo38
1 files changed, 17 insertions, 21 deletions
diff --git a/scripts/sysinfo b/scripts/sysinfo
index 90bac9a..8acc18d 100755
--- a/scripts/sysinfo
+++ b/scripts/sysinfo
@@ -1,15 +1,11 @@
#!/bin/sh
-batperc=$(cat /sys/class/power_supply/BAT0/capacity)
-batstate=$(cat /sys/class/power_supply/BAT0/status)
-brightness=$(brightnessctl -m | cut -d, -f 4)
-
-network_info() {
+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) }')
+ | awk -F' ' '{ printf($3) }')
echo "${device}: ${network}"
;;
eth*)
@@ -18,24 +14,24 @@ network_info() {
esac
}
-get_volume() {
- wpctl get-volume @DEFAULT_SINK@ | awk -F' ' '{ printf "%s %s%% %s", $1, ($2 * 100), $3; }'
-}
-if [ "$TERM" = "linux" ]; then
- notify-send \
- "System Info:" \
- "\
+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")
-$(get_volume)
+${volume}
Brightness: ${brightness}
${batstate}: ${batperc}%
-$(network_info)"
+${network}"
+
+if [ "$TERM" = "linux" ]; then
+ notify-send "$header" "$message"
else
- echo "\
-Time: $(date "+%I:%M:%S")
-$(get_volume)
-Brightness: ${brightness}
-${batstate}: ${batperc}%
-$(network_info)"
+ echo "$message"
fi