-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathufetch
More file actions
76 lines (67 loc) · 1.91 KB
/
Copy pathufetch
File metadata and controls
76 lines (67 loc) · 1.91 KB
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
#!/bin/bash
# Ufetch
# A simple screenfetch alternative
# Original code from https://github.com/jschx/ufetch
# I just slightly modified this
# Cheers! Addy
## Get system info
user="${USER}@$(hostname)"
distro='Debian'
kernel="$(uname -sr | sed 's/-.*//')"
uptime="$(uptime -p | sed 's/up //')"
packages="$(dpkg -l | wc -l)"
shell="$(basename ${SHELL})"
if [ -z "${WM}" ]; then
if [ "${XDG_CURRENT_DESKTOP}" ]; then
envtype='DE'
WM="${XDG_CURRENT_DESKTOP}"
elif [ "${DESKTOP_SESSION}" ]; then
envtype='DE'
WM="${DESKTOP_SESSION}"
else
envtype='WM'
WM="$(tail -n 1 "${HOME}/.xinitrc" | cut -d ' ' -f 2)"
fi
else
envtype='WM'
fi
## Define Colours
if [[ $1 = "--red" ]]; then
bgaccent="$(tput setab 1)"
accent="$(tput setaf 1)"
elif [[ $1 = "--green" ]]; then
bgaccent="$(tput setab 2)"
accent="$(tput setaf 2)"
elif [[ $1 = "--yellow" ]]; then
bgaccent="$(tput setab 3)"
accent="$(tput setaf 3)"
elif [[ $1 = "--blue" ]]; then
bgaccent="$(tput setab 4)"
accent="$(tput setaf 4)"
elif [[ $1 = "--magenta" ]]; then
bgaccent="$(tput setab 5)"
accent="$(tput setaf 5)"
elif [[ $1 = "--cyan" ]]; then
bgaccent="$(tput setab 6)"
accent="$(tput setaf 6)"
else
bgaccent="$(tput setab 1)"
accent="$(tput setaf 1)"
fi
bold="$(tput bold)"
white="$(tput setaf 7)"
reset="$(tput sgr0)"
cbg="${reset}${bold}${bgaccent}${white}"
cr="${reset}"
c0="${reset}${bold}"
c1="${reset}${accent}"
## Output
cat <<EOF
${c0}${cbg} _____ ${c1} USER ${cr}${user}${reset}
${c0}${cbg} / __ \\ ${c1} DISTRO ${cr}${distro}${reset}
${c0}${cbg} | / | ${c1} KERNEL ${cr}${kernel}${reset}
${c0}${cbg} | \\___- ${c1} UPTIME ${cr}${uptime}${reset}
${c0}${cbg} -_ ${c1} ${envtype} ${cr}${WM}${reset}
${c0}${cbg} --_ ${c1} SHELL ${cr}${shell}${reset}
${c0}${cbg} ${c1} PACKAGES ${cr}${packages}${reset}
EOF