-
Notifications
You must be signed in to change notification settings - Fork 3
/
duckfetch
executable file
路80 lines (68 loc) 路 1.95 KB
/
duckfetch
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env bash
# colors
GREEN="\x1B[32m"
YELLOW="\x1B[33m"
YELLOW_BRIGHT="\x1B[93m"
BLUE="\x1B[34m"
CYAN="\033[36m"
RED="\033[1;31m"
WHITE="\x1B[37m"
BOLD="\x1B[1m"
RESET="\x1B[0m"
displayInfo() {
if [[ $(uname -o) == "Android" ]]; then
user=$(whoami)
title=$user@$HOSTNAME
os="Android $(getprop ro.build.version.release)"
uptime=$(uptime -p | sed 's/up//')
shell=$(basename $SHELL)
else
title=$USER
hostname=$HOSTNAME
user=$(whoami)
os=$(grep -m1 "NAME=" < /etc/os-release | cut -d '"' -f 2)
uptime=$(uptime -p | sed 's/up//')
font=$(fc-match | sed 's/\..*//g')
shell=$(basename $SHELL)
memory=$(free --mega | awk 'NR == 2 { print $3" / "$2" MB" }')
wm=${WAYLAND_DISPLAY:-$(xprop -id "$(xprop -root _NET_SUPPORTING_WM_CHECK | cut -d' ' -f5)" _NET_WM_NAME | cut -d'"' -f2)}
fi
}
setInfo() {
displayInfo
cat <<EOF
${BOLD}${CYAN}$title${RESET}${BOLD}${RED}@${BOLD}${GREEN}$hostname${RESET}
${BOLD}${GREEN}user ${RESET} $user
${BOLD}${YELLOW_BRIGHT}OS ${RESET} $os
${BOLD}${RED}shell ${RESET} $shell
${BOLD}${YELLOW}font ${RESET} $font
${BOLD}${BLUE}WM ${RESET} $wm
${BOLD}${CYAN}memory${RESET} $memory
${BOLD}${WHITE}upt ${RESET} $uptime
\n
EOF
}
duck="
$YELLOW_BRIGHT ,~~. $RESET
$YELLOW_BRIGHT\ ( $RESET- $YELLOW_BRIGHT)$YELLOW>$RESET
$YELLOW_BRIGHT)~~ ( $RESET
$YELLOW_BRIGHT( .__) )$RESET
$YELLOW_BRIGHT ~-_____.) $RESET
"
case "$(echo $d)" in
*) ascii="$duck" ;;
esac
if [[ "$1" ]]; then
while [[ "$1" ]]; do
case "$1" in
-h|--help) echo "hi" && exit 0 ;;
-v|--version) echo Version 1.0 && exit 0 ;;
*) echo "[!] Invalid option! Use --help" && exit 1 ;;
esac
shift
done
else
paste <(printf "%b" "$ascii") <(printf "%b" "$(setInfo)") | cat
fi
exit 0
setInfo