diff options
Diffstat (limited to 'scripts/sysinfo')
| -rwxr-xr-x | scripts/sysinfo | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/scripts/sysinfo b/scripts/sysinfo index 8acc18d..5cb2d07 100755 --- a/scripts/sysinfo +++ b/scripts/sysinfo @@ -1,37 +1,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 -} +get_message() { + # Date + echo "Date: $(date +"%a %b %d")" + echo "Time: $(date +"%I:%M:%S")" + + # Volume + echo "$(wpctl get-volume @DEFAULT_SINK@ | awk -F' ' '{ printf "%s %s%% %s", $1, ($2 * 100), $3; }')" -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) + # Brightness + echo "Brightness: $(brightnessctl -m | cut -d, -f 4)" + + # Battery + echo "$(cat /sys/class/power_supply/BAT0/status): $(cat /sys/class/power_supply/BAT0/capacity)%" + + # Network Info + net_device=$(ip a | grep "state UP" | awk -F': ' '{ printf($2) }') + case "${net_device}" in + wlan*) + connected_network=$(iwctl station ${net_device} show | grep 'Connected network' \ + | awk -F' ' '{ printf($3) }') + ;; + eth*) + ;; + esac + echo "${net_device}: ${connected_network}" +} -header="System Info:" -message="\ -Date: $(date +"%a %b %d") -Time: $(date "+%I:%M:%S") -${volume} -Brightness: ${brightness} -${batstate}: ${batperc}% -${network}" +message=$(get_message) if [ "$TERM" = "linux" ]; then - notify-send "$header" "$message" + notify-send "System Info" "$message" else echo "$message" fi |
