-
Notifications
You must be signed in to change notification settings - Fork 0
/
ufetch-arch
52 lines (46 loc) · 1.42 KB
/
ufetch-arch
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
#!/bin/bash
# ufetch-arch - tiny system info for Arch
# System information
host=$(</etc/hostname)
os='Arch Linux'
kernel=$(uname -sr)
uptime=$(uptime -p | sed 's/up //')
packages=$(pacman -Q | wc -l)
shell=$(basename "$SHELL")
# User interface detection
get_ui() {
for f in "$@"; do
wm=$(tail -n 1 "$f" 2> /dev/null | awk '{print $2}')
[ -n "$wm" ] && { echo "$wm"; return; }
done
}
rcwm=$(get_ui "$HOME/.xinitrc" "$HOME/.xsession")
if [ -n "$DE" ]; then
ui="$DE"
uitype='DE'
elif [ -n "$WM" ]; then
ui="$WM"
uitype='WM'
elif [ -n "$XDG_CURRENT_DESKTOP" ]; then
ui="$XDG_CURRENT_DESKTOP"
uitype='DE'
elif [ -n "$DESKTOP_SESSION" ]; then
ui="$DESKTOP_SESSION"
uitype='DE'
elif [ -n "$rcwm" ]; then
ui="$rcwm"
uitype='WM'
elif [ -n "$XDG_SESSION_TYPE" ]; then
ui="$XDG_SESSION_TYPE"
fi
ui=$(basename "$ui")
# Output with color formatting
echo
echo -e "\033[1;34m /\\ \033[0m$USER\033[1;34m@\033[0m$host"
echo -e "\033[1;34m / \\ \033[1;34mOS: \033[0m$os"
echo -e "\033[1;34m /\\ \\ \033[1;34mKERNEL: \033[0m$kernel"
echo -e "\033[1;34m / __ \\ \033[1;34mUPTIME: \033[0m$uptime"
echo -e "\033[1;34m / ( ) \\ \033[1;34mPACKAGES: \033[0m$packages"
echo -e "\033[1;34m / __| |__ \\ \033[1;34mSHELL: \033[0m$shell"
echo -e "\033[1;34m /.\` \`.\\ \033[1;34m$uitype: \033[0m$ui"
echo