-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtreefetch
executable file
·68 lines (60 loc) · 1.6 KB
/
treefetch
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
#!/bin/bash
RESET="\033[0;m"
c1="$(printf '%b\e[3%sm' "$RESET" 3)"
c2=$(echo -e "${RESET}\033[38;5;208m")
c3=$(echo -e "${RESET}\033[38;5;215m")
os=$(./utils/get_os | awk 'NR==1 {print $2 " " $3 " " $4}')
os_ver=$(./utils/get_os | awk 'NR==2 {print $2 " " $3 " " $4}')
pkgs=$(./utils/get_packages)
#pkg_names=$(./utils/get_packages --names)
if [ -z "$DE" ]
then
de=$(./utils/get_desktop)
if [[ "$de" == "XDG_CURRENT_DESKTOP env not found" || "$DE" == "de not recognised" ]]
then
ignore_de=true
fi
else
de="${DE}"
fi
if [ -z "$WM" ]
then
wm=$(./utils/get_wm)
if [[ "$wm" == "wm not found please submit an issue" || "$WM" == "error, no env variable with name wm, WM, WINDOW_MANAGER or window_manager found" ]]
then
ignore_wm="true"
fi
else
wm="${WM}"
fi
if [[ "$ignore_de" == "true" && "$ignore_wm" == "true" ]]
then
# tree structure copied from tfetch
echo -e ".
├─ ${c1}distro${RESET}
│ ├─ ${c3}${os}${RESET}
│ └─ ${c3}${os_ver}${RESET}
├─ ${c1}packages${RESET}
│ └─ ${c2}all${RESET}
│ └─ ${c3}${pkgs}${RESET}
└─ ${c1}shell${RESET}
└─ ${c3}${SHELL##*/}${RESET}
"
else
# tree structure copied from tfetch
echo -e ".
├─ ${c1}distro${RESET}
│ ├─ ${c3}${os}${RESET}
│ └─ ${c3}${os_ver}${RESET}
├─ ${c1}packages${RESET}
│ └─ ${c2}all${RESET}
│ └─ ${c3}${pkgs}${RESET}
├─ ${c1}env${RESET}
│ ├─ ${c2}de${RESET}
│ │ └─ ${c3}${de}${RESET}
│ └─ ${c2}wm${RESET}
│ └─ ${c3}${wm}${RESET}
└─ ${c1}shell${RESET}
└─ ${c3}${SHELL##*/}${RESET}
"
fi