From be8c956b0e819f2db0c6ae3598b6590b62982a83 Mon Sep 17 00:00:00 2001 From: Jack Jamison Date: Tue, 5 May 2026 21:53:16 -0400 Subject: been a while --- scripts/sysinfo | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) (limited to 'scripts/sysinfo') 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 -- cgit v1.2.3