summaryrefslogtreecommitdiff
path: root/scripts/system/sysinfo
blob: 5cb2d0751d91168b2614730c8ebf60aa4d0e97c0 (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_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; }')"

	# 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}"
}

message=$(get_message)

if [ "$TERM" = "linux" ]; then
	notify-send "System Info" "$message"
else
	echo "$message"
fi