This repository has been archived by the owner on Dec 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
catfetchposix
executable file
·153 lines (138 loc) · 4.22 KB
/
catfetchposix
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/usr/bin/env sh
#COLOR VARIABLES
RED="\033[38;5;1m"
YELLOW="\033[38;5;3m"
GREEN="\033[38;5;2m"
CYAN="\033[38;5;6m"
BLUE="\033[38;5;4m"
PURPLE="\033[38;5;5m"
BLACK="\033[38;5;8m"
WHITE="\033[38;5;m"
B_RED="\033[38;5;9m"
B_YELLOW="\033[38;5;11m"
B_GREEN="\033[38;5;10m"
B_CYAN="\033[38;5;14m"
B_BLUE="\033[38;5;12m"
B_PURPLE="\033[38;5;13m"
B_WHITE="\033[38;5;0m"
GRAY="\033[38;5;16m"
CLS="\033[m"
# CUSTOMIZZATION ZONE
# Cool characters for the symbol ◆ ◀ ▧ ▨ ▦ ▥ ▤ ▣ ● ◕ █
SYMBOL="●"
SEPARATOR="-"
# Set colors
TXTCOL=$YELLOW
WORDCOL=$GREEN
CATCOL=$CYAN
# TESTS ZONE
# Old WM script (not used anymore) by Alberto Salvia Novella (es20490446e.wordpress.com)
CPU=$(grep -m 1 'model name' /proc/cpuinfo | awk -P '{print $4" "$5" "$6" "$7" "$8" "$9" "$10}')
RAM=$(free -h | grep "^Mem:" | awk -P '{print $3 "/" $2}')
OS=$(grep -m1 "NAME=" < /etc/os-release | cut -d '"' -f 2)
WM=${WAYLAND_DISPLAY:-$(xprop -id "$(xprop -root _NET_SUPPORTING_WM_CHECK | cut -d' ' -f5)" _NET_WM_NAME | cut -d'"' -f2)} # thanks to kazoku
ARCH=$(uname -m)
NODE=$(uname -n)
KERNEL_NAME=$(uname -s)
KERNEL_REL=$(uname -r)
SHELL_NAME=$SHELL
UPTIME=$(uptime -p) # ??
USED_SPACE=$(df -P -h / | awk -P '{print $3}' | grep "^[0-9]") # not sure if grep here is posix-compliant
TOTAL_SPACE=$(df -P -h / | awk -P '{print $2}' | grep "^[0-9]")
Help()
{
printf "
-m Adds more info, like the system architecture and graphic session(X11 or WAYLAND) to the output
-d Adds your dark color palette to the output
-b Adds your bright color palette to the output
-c Adds both your dark and bright color palette to the output
-a Adds all of the options above
-h Shows this help message\n
This program is licensed under the GPLv3 license.\n
If you encounter any issue or want a feature to be added please open an issue on the GitHub page.
https://github.com/jhonnyrice/cat-fetch-reborn\n
"
}
# Get Help Message
if [ "$1" = "-h" ]
then
printf "${CLS}"
Help
exit 0
fi
ExtraInfo()
{
printf " ${WORDCOL}arch: ${TXTCOL}${ARCH}\n"
printf " ${WORDCOL}graphic session: ${TXTCOL}$XDG_SESSION_TYPE\n"
printf " ${WORDCOL}cpu: ${TXTCOL}${CPU}\n"
printf " ${WORDCOL}ram: ${TXTCOL}${RAM}\n"
printf " ${WORDCOL}Disk space: ${TXTCOL}Used ${USED_SPACE} of ${TOTAL_SPACE}\n"
}
DarkColor()
{
printf " ${RED} ${SYMBOL} ${YELLOW} ${SYMBOL} ${GREEN} ${SYMBOL} ${CYAN} ${SYMBOL} ${BLUE} ${SYMBOL} ${PURPLE} ${SYMBOL} ${WHITE} ${SYMBOL} ${BLACK} ${SYMBOL} ${CLS}\n"
}
BrightColor()
{
printf " ${B_RED} ${SYMBOL} ${B_YELLOW} ${SYMBOL} ${B_GREEN} ${SYMBOL} ${B_CYAN} ${SYMBOL} ${B_BLUE} ${SYMBOL} ${B_PURPLE} ${SYMBOL} ${B_WHITE} ${SYMBOL} ${GRAY} ${SYMBOL} ${CLS}\n"
}
Separator()
{
printf " ${CLS}"
i=1
while [ "$i" -ne 24 ]
do
printf "$SEPARATOR"
i=$((i + 1))
done
printf "\n"
}
printf "${CATCOL} $NODE@$LOGNAME ${CLS}\n"
printf " "
LENGTH=${#NODE}+${#LOGNAME}+1
while [ "$i" != 18 ]
do
printf "$SEPARATOR"
i=$((i + 1))
done
i=0
printf "${CLS}\n"
printf "${CATCOL} /'._ ${WORDCOL}os: ${TXTCOL}${OS}\n"
printf "${CATCOL} (° o 7 ${WORDCOL}wm: ${TXTCOL}${WM}\n"
printf "${CATCOL} |'-'\"~. . ${WORDCOL}shell: ${TXTCOL}${SHELL_NAME}\n"
printf "${CATCOL} Uu^~C_J._.\" ${WORDCOL}uptime: ${TXTCOL}${UPTIME}\n"
printf "${CATCOL} ${WORDCOL}kernel: ${TXTCOL}${KERNEL_NAME} ${KERNEL_REL}\n$CLS"
while getopts ":mabdc" option; do
case $option in
m) # Get more info
ExtraInfo
printf "${CLS}";;
a) # Get all of the info
ExtraInfo
Separator
DarkColor
BrightColor
printf "${CLS}";;
b) # Display bright color palette
Separator
BrightColor
printf "${CLS}";;
d) # Display dark color palette
Separator
DarkColor
printf "${CLS}";;
c) # Display both bright and dark color palette
Separator
DarkColor
BrightColor
printf "${CLS}";;
?) # Get unknown command output
printf "${CLS}\n"
printf "This option does not exist. For the full list of options please use the command 'catfetch -h'\n"
exit;;
esac
done
# /'._ ._
#(- = 7___.~'
# |--'' )
# LL_)'CC_J