mirror of
https://github.com/EnumeratedDev/stormfetch.git
synced 2026-09-16 07:56:12 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75deb165ad | ||
|
|
56511c90db | ||
|
|
42a60296a9 | ||
|
|
af4c534685 | ||
|
|
25a596cd5e | ||
|
|
4d414daccc | ||
|
|
664b639fb9 | ||
|
|
2b33b64602 | ||
|
|
200e300be0 | ||
|
|
139e64d682 | ||
|
|
0608d1b84b | ||
|
|
325d6bff13 |
@@ -1,2 +1,4 @@
|
|||||||
.idea
|
.idea
|
||||||
build
|
build
|
||||||
|
stormfetch
|
||||||
|
stormfetch.tar.gz
|
||||||
@@ -7,10 +7,13 @@ endif
|
|||||||
ifeq ($(SYSCONFDIR),)
|
ifeq ($(SYSCONFDIR),)
|
||||||
SYSCONFDIR := $(PREFIX)/etc
|
SYSCONFDIR := $(PREFIX)/etc
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(GO),)
|
||||||
|
GO := /usr/bin/go
|
||||||
|
endif
|
||||||
|
|
||||||
build:
|
build:
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
go build -o build/stormfetch stormfetch
|
$(GO) build -o build/stormfetch stormfetch
|
||||||
|
|
||||||
install: build/stormfetch config/
|
install: build/stormfetch config/
|
||||||
mkdir -p $(DESTDIR)$(BINDIR)
|
mkdir -p $(DESTDIR)$(BINDIR)
|
||||||
@@ -18,5 +21,13 @@ install: build/stormfetch config/
|
|||||||
cp build/stormfetch $(DESTDIR)$(BINDIR)/stormfetch
|
cp build/stormfetch $(DESTDIR)$(BINDIR)/stormfetch
|
||||||
cp -r config/. $(DESTDIR)$(SYSCONFDIR)/stormfetch/
|
cp -r config/. $(DESTDIR)$(SYSCONFDIR)/stormfetch/
|
||||||
|
|
||||||
|
compress: build/stormfetch config/
|
||||||
|
mkdir -p stormfetch/$(BINDIR)
|
||||||
|
mkdir -p stormfetch/$(SYSCONFDIR)/stormfetch/
|
||||||
|
cp build/stormfetch stormfetch/$(BINDIR)/stormfetch
|
||||||
|
cp -r config/. stormfetch/$(SYSCONFDIR)/stormfetch/
|
||||||
|
tar --owner=root --group=root -czf stormfetch.tar.gz stormfetch
|
||||||
|
rm -r stormfetch
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -r build/
|
rm -r build/
|
||||||
@@ -6,12 +6,17 @@
|
|||||||
- [CapCreeperGR ](https://gitlab.com/CapCreeperGR)
|
- [CapCreeperGR ](https://gitlab.com/CapCreeperGR)
|
||||||
|
|
||||||
### Project Information
|
### Project Information
|
||||||
Stormfetch is a program that can read your system's information and display it in the terminal along with ascii art of the linux distribution you are running.
|
Stormfetch is a program that can read your system's information and display it in the terminal along with the ASCII art of the Linux distribution you are running.
|
||||||
Stormfetch is still in beta and distro compatibility is limited. If you would like to contribute ascii art or add other compatibility features feel free to create a pull request or notify me through gitlab issues
|
Stormfetch is still in beta, so distro compatibility is limited. If you would like to contribute ASCII art or add other compatibility features feel free to create a pull request or notify me through GitLab Issues.
|
||||||
|
|
||||||
### Installation Guide
|
### Installation Guide
|
||||||
|
#### AUR
|
||||||
|
- If you are on Arch Linux, you can use your favorite AUR manager to install the `stormfetch` package.
|
||||||
|
#### Building from source
|
||||||
- Download `go` from your package manager or from the go website
|
- Download `go` from your package manager or from the go website
|
||||||
- Download `make` from your package manager
|
- Download `make` from your package manager
|
||||||
|
- (Optional) Download `xorg-xhost` from your package manager to display DE/WM and monitor information
|
||||||
|
- (Optional) Download `xorg-xdpyinfo` from your package manager to display screen resolution
|
||||||
- (Optional) Download `lshw` from your package manager to display GPU information
|
- (Optional) Download `lshw` from your package manager to display GPU information
|
||||||
- Run the following command to compile the project
|
- Run the following command to compile the project
|
||||||
```
|
```
|
||||||
|
|||||||
+5
-4
@@ -1,4 +1,5 @@
|
|||||||
-`
|
#/4;27;4;11
|
||||||
|
${C1} -`
|
||||||
.o+`
|
.o+`
|
||||||
`ooo/
|
`ooo/
|
||||||
`+oooo:
|
`+oooo:
|
||||||
@@ -7,9 +8,9 @@
|
|||||||
`/:-:++oooo+:
|
`/:-:++oooo+:
|
||||||
`/++++/+++++++:
|
`/++++/+++++++:
|
||||||
`/++++++++++++++:
|
`/++++++++++++++:
|
||||||
`/+++ooooooooooooo/`
|
`/+++o${C2}oooooooo${C1}oooo/`
|
||||||
./ooosssso++osssssso+`
|
${C2} ${C1}./${C2}ooosssso++osssssso${C1}+`
|
||||||
.oossssso-````/ossssss+`
|
${C2} .oossssso-````/ossssss+`
|
||||||
-osssssso. :ssssssso.
|
-osssssso. :ssssssso.
|
||||||
:osssssss/ osssso+++.
|
:osssssss/ osssso+++.
|
||||||
/ossssssss/ +ssssooo/-
|
/ossssssss/ +ssssooo/-
|
||||||
|
|||||||
+17
-16
@@ -1,16 +1,17 @@
|
|||||||
_,met$$$$$gg.
|
#/1;7;9;15
|
||||||
,g$$$$$$$$$$$$$$$P.
|
${C2} _,met&&&&&gg.
|
||||||
,g$$P" """Y$$.".
|
,g&&&&&&&&&&&&&&&P.
|
||||||
,$$P' `$$$.
|
,g&&P" """Y&&.".
|
||||||
',$$P ,ggs. `$$b:
|
,&&P' `&&&.
|
||||||
`d$$' ,$P"' . $$$
|
',&&P ,ggs. `&&b:
|
||||||
$$P d$' , $$P
|
`d&&' ,&P"' ${C1}.${C2} &&&
|
||||||
$$: $$. - ,d$$'
|
&&P d&' ${C1},${C2} &&P
|
||||||
$$; Y$b._ _,d$P'
|
&&: &&. ${C1}-${C2} ,d&&'
|
||||||
Y$$. `.`"Y$$$$P"'
|
&&; Y&b._ _,d&P'
|
||||||
`$$b "-.__
|
Y&&. ${C1}`.${C2}`"Y&&&&P"'
|
||||||
`Y$$
|
${C2} `&&b ${C1}"-.__
|
||||||
`Y$$.
|
${C2} `Y&&
|
||||||
`$$b.
|
`Y&&.
|
||||||
`Y$$b.
|
`&&b.
|
||||||
`"Y$b._
|
`Y&&b.
|
||||||
|
`"Y&b._
|
||||||
|
|||||||
+14
-13
@@ -1,19 +1,20 @@
|
|||||||
.',;::::;,'.
|
#/12;7;4;15
|
||||||
|
${C1} .',;::::;,'.
|
||||||
.';:cccccccccccc:;,.
|
.';:cccccccccccc:;,.
|
||||||
.;cccccccccccccccccccccc;.
|
.;cccccccccccccccccccccc;.
|
||||||
.:cccccccccccccccccccccccccc:.
|
.:cccccccccccccccccccccccccc:.
|
||||||
.;ccccccccccccc;.:dddl:.;ccccccc;.
|
.;ccccccccccccc;${C2}.:dddl:.${C1};ccccccc;.
|
||||||
.:ccccccccccccc;OWMKOOXMWd;ccccccc:.
|
.:ccccccccccccc;${C2}OWMKOOXMWd${C1};ccccccc:.
|
||||||
.:ccccccccccccc;KMMc;cc;xMMc;ccccccc:.
|
.:ccccccccccccc;${C2}KMMc${C1};cc;${C2}xMMc${C1};ccccccc:.
|
||||||
,cccccccccccccc;MMM.;cc;;WW:;cccccccc,
|
,cccccccccccccc;${C2}MMM.${C1};cc;${C2};WW:${C1};cccccccc,
|
||||||
:cccccccccccccc;MMM.;cccccccccccccccc:
|
:cccccccccccccc;${C2}MMM.${C1};cccccccccccccccc:
|
||||||
:ccccccc;oxOOOo;MMM0OOk.;cccccccccccc:
|
:ccccccc;${C2}oxOOOo${C1};${C2}MMM0OOk.${C1};cccccccccccc:
|
||||||
cccccc;0MMKxdd:;MMMkddc.;cccccccccccc;
|
cccccc;${C2}0MMKxdd:${C1};${C2}MMMkddc.${C1};cccccccccccc;
|
||||||
ccccc;XM0';cccc;MMM.;cccccccccccccccc'
|
ccccc;${C2}XM0'${C1};cccc;${C2}MMM.${C1};cccccccccccccccc'
|
||||||
ccccc;MMo;ccccc;MMW.;ccccccccccccccc;
|
ccccc;${C2}MMo${C1};ccccc;${C2}MMW.${C1};ccccccccccccccc;
|
||||||
ccccc;0MNc.ccc.xMMd;ccccccccccccccc;
|
ccccc;${C2}0MNc.${C1}ccc${C2}.xMMd${C1};ccccccccccccccc;
|
||||||
cccccc;dNMWXXXWM0:;cccccccccccccc:,
|
cccccc;${C2}dNMWXXXWM0:${C1};cccccccccccccc:,
|
||||||
cccccccc;.:odl:.;cccccccccccccc:,.
|
cccccccc;${C2}.:odl:.${C1};cccccccccccccc:,.
|
||||||
:cccccccccccccccccccccccccccc:'.
|
:cccccccccccccccccccccccccccc:'.
|
||||||
.:cccccccccccccccccccccc:;,..
|
.:cccccccccccccccccccccc:;,..
|
||||||
'::cccccccccccccc::;,.
|
'::cccccccccccccc::;,.
|
||||||
|
|||||||
+18
-17
@@ -1,18 +1,19 @@
|
|||||||
-/oyddmdhs+:.
|
#/5;7;13;69
|
||||||
-odNMMMMMMMMNNmhy+-`
|
${C1} -/oyddmdhs+:.
|
||||||
-yNMMMMMMMMMMMNNNmmdhy+-
|
-o${C2}dNMMMMMMMMNNmhy+${C1}-`
|
||||||
`omMMMMMMMMMMMMNmdmmmmddhhy/`
|
-y${C2}NMMMMMMMMMMMNNNmmdhy${C1}+-
|
||||||
omMMMMMMMMMMMNhhyyyohmdddhhhdo`
|
`o${C2}mMMMMMMMMMMMMNmdmmmmddhhy${C1}/`
|
||||||
.ydMMMMMMMMMMdhs++so/smdddhhhhdm+`
|
om${C2}MMMMMMMMMMMN${C1}hhyyyo${C2}hmdddhhhd${C1}o`
|
||||||
oyhdmNMMMMMMMNdyooydmddddhhhhyhNd.
|
.y${C2}dMMMMMMMMMMd${C1}hs++so/s${C2}mdddhhhhdm${C1}+`
|
||||||
:oyhhdNNMMMMMMMNNNmmdddhhhhhyymMh
|
oy${C2}hdmNMMMMMMMN${C1}dyooy${C2}dmddddhhhhyhN${C1}d.
|
||||||
.:+sydNMMMMMNNNmmmdddhhhhhhmMmy
|
:o${C2}yhhdNNMMMMMMMNNNmmdddhhhhhyym${C1}Mh
|
||||||
/mMMMMMMNNNmmmdddhhhhhmMNhs:
|
.:${C2}+sydNMMMMMNNNmmmdddhhhhhhmM${C1}my
|
||||||
`oNMMMMMMMNNNmmmddddhhdmMNhs+`
|
/m${C2}MMMMMMNNNmmmdddhhhhhmMNh${C1}s:
|
||||||
`sNMMMMMMMMNNNmmmdddddmNMmhs/.
|
`o${C2}NMMMMMMMNNNmmmddddhhdmMNhs${C1}+`
|
||||||
/NMMMMMMMMNNNNmmmdddmNMNdso:`
|
`s${C2}NMMMMMMMMNNNmmmdddddmNMmhs${C1}/.
|
||||||
+MMMMMMMNNNNNmmmmdmNMNdso/-
|
/N${C2}MMMMMMMMNNNNmmmdddmNMNdso${C1}:`
|
||||||
yMMNNNNNNNmmmmmNNMmhs+/-`
|
+M${C2}MMMMMMNNNNNmmmmdmNMNdso${C1}/-
|
||||||
/hMMNNNNNNNNMNdhs++/-`
|
yM${C2}MNNNNNNNmmmmmNNMmhs+/${C1}-`
|
||||||
`/ohdmmddhys+++/:.`
|
/h${C2}MMNNNNNNNNMNdhs++/${C1}-`
|
||||||
|
`/${C2}ohdmmddhys+++/:${C1}.`
|
||||||
`-//////:--.
|
`-//////:--.
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#/2;7;10;15
|
||||||
|
${C2} .;ldkO0000Okdl;.
|
||||||
|
.;d00xl:^''''''^:ok00d;.
|
||||||
|
.d00l' 'o00d.
|
||||||
|
.d0Kd'${C1} Okxol:;,. ${C2}:O0d.
|
||||||
|
.OK${C1}KKK0kOKKKKKKKKKKOxo:, ${C2}lKO.
|
||||||
|
,0K${C1}KKKKKKKKKKKKKKK0P^${C2},,,${C1}^dx:${C2} ;00,
|
||||||
|
.OK${C1}KKKKKKKKKKKKKKKk'${C2}.oOPPb.${C1}'0k.${C2} cKO.
|
||||||
|
:KK${C1}KKKKKKKKKKKKKKK: ${C2}kKx..dd ${C1}lKd${C2} 'OK:
|
||||||
|
dKK${C1}KKKKKKKKKOx0KKKd ${C2}^0KKKO' ${C1}kKKc${C2} dKd
|
||||||
|
dKK${C1}KKKKKKKKKK;.;oOKx,..${C2}^${C1}..;kKKK0.${C2} dKd
|
||||||
|
:KK${C1}KKKKKKKKKK0o;...^cdxxOK0O/^^' ${C2}.0K:
|
||||||
|
kKK${C1}KKKKKKKKKKKKK0x;,,......,;od ${C2}lKk
|
||||||
|
'0K${C1}KKKKKKKKKKKKKKKKKKKK00KKOo^ ${C2}c00'
|
||||||
|
'kK${C1}KKOxddxkOO00000Okxoc;'' ${C2}.dKk'
|
||||||
|
l0Ko. .c00l'
|
||||||
|
'l0Kk:. .;xK0l'
|
||||||
|
'lkK0xl:;,,,,;:ldO0kl'
|
||||||
|
'^:ldxkkkkxdl:^'
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
#/2;7;10;15
|
||||||
|
${C1} ......
|
||||||
|
.,cdxxxoc,. .:kKMMMNWMMMNk:.
|
||||||
|
cKMMN0OOOKWMMXo. ; ;0MWk:. .:OMMk.
|
||||||
|
;WMK;. .lKMMNM, :NMK, .OMW;
|
||||||
|
cMW; 'WMMMN ,XMK, oMM'
|
||||||
|
.MMc ..;l. xMN: KM0
|
||||||
|
'MM. 'NMO oMM
|
||||||
|
.MM, .kMMl xMN
|
||||||
|
KM0 .kMM0. .dl:,.. .WMd
|
||||||
|
.XM0. ,OMMK, OMMMK. .XMK
|
||||||
|
oWMO:. .;xNMMk, NNNMKl. .xWMx
|
||||||
|
:ONMMNXMMMKx; . ,xNMWKkxllox0NMWk,
|
||||||
|
..... .:dOOXXKOxl,
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#/6;10;5;12
|
||||||
|
${C1} @@@@@@@@@
|
||||||
|
@@@~~~~~~~~~@@
|
||||||
|
@@~~~ ~~@
|
||||||
|
@~~ @
|
||||||
|
@~ @@@ @
|
||||||
|
@@~ @ @@
|
||||||
|
@@~~ @
|
||||||
|
@@@~~ ~@@ @@@
|
||||||
|
~~~ ~~@@@ @@@@~~~
|
||||||
|
~~~@@@@~~~~
|
||||||
|
@@@@ @@@@@@@ ~~~~ @@@@
|
||||||
|
~~~~@@@@ @@~~~~~~~@@ @@@@
|
||||||
|
~~~~@@@@~~ ~~@@@@~~~~
|
||||||
|
@@@ ~~~~ @@@@@ ~~~~ @@@
|
||||||
|
~~~@@@@ @@@@~~~~~@@@@ @@@@~~~
|
||||||
|
~~~~@@@~~~~ ~~~~@@@~~~
|
||||||
|
~~~ ~~~
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#/1;7;3;15
|
||||||
|
${C1} .-/+oossssoo+\-.
|
||||||
|
´:+ssssssssssssssssss+:`
|
||||||
|
-+ssssssssssssssssssyyssss+-
|
||||||
|
.ossssssssssssssssss${C2}dMMMNy${C1}sssso.
|
||||||
|
/sssssssssss${C2}hdmmNNmmyNMMMMh${C1}ssssss\
|
||||||
|
+sssssssss${C2}hm${C1}yd${C2}MMMMMMMNddddy${C1}ssssssss+
|
||||||
|
/ssssssss${C2}hNMMM${C1}yh${C2}hyyyyhmNMMMNh${C1}ssssssss\
|
||||||
|
.ssssssss${C2}dMMMNh${C1}ssssssssss${C2}hNMMMd${C1}ssssssss.
|
||||||
|
+ssss${C2}hhhyNMMNy${C1}ssssssssssss${C2}yNMMMy${C1}sssssss+
|
||||||
|
oss${C2}yNMMMNyMMh${C1}ssssssssssssss${C2}hmmmh${C1}ssssssso
|
||||||
|
oss${C2}yNMMMNyMMh${C1}sssssssssssssshmmmh${C1}ssssssso
|
||||||
|
+ssss${C2}hhhyNMMNy${C1}ssssssssssss${C2}yNMMMy${C1}sssssss+
|
||||||
|
.ssssssss${C2}dMMMNh${C1}ssssssssss${C2}hNMMMd${C1}ssssssss.
|
||||||
|
\ssssssss${C2}hNMMM${C1}yh${C2}hyyyyhdNMMMNh${C1}ssssssss/
|
||||||
|
+sssssssss${C2}dm${C1}yd${C2}MMMMMMMMddddy${C1}ssssssss+
|
||||||
|
\sssssssssss${C2}hdmNNNNmyNMMMMh${C1}ssssss/
|
||||||
|
.ossssssssssssssssss${C2}dMMMNy${C1}sssso.
|
||||||
|
-+sssssssssssssssss${C2}yyy${C1}ssss+-
|
||||||
|
`:+ssssssssssssssssss+:`
|
||||||
|
.-\+oossssoo+/-.
|
||||||
@@ -1,2 +1,5 @@
|
|||||||
distro_ascii: auto
|
distro_ascii: auto
|
||||||
fetch_script: auto
|
fetch_script: auto
|
||||||
|
ansii_colors: []
|
||||||
|
force_config_ansii: false
|
||||||
|
dependency_warning: true
|
||||||
|
|||||||
+14
-10
@@ -1,17 +1,21 @@
|
|||||||
source fetch_script_functions.sh
|
source fetch_script_functions.sh
|
||||||
|
|
||||||
echo "Distribution: ${DISTRO_LONG_NAME} ($(uname -m))"
|
echo -e "${C3}Distribution: ${C4}${DISTRO_LONG_NAME} ($(uname -m))"
|
||||||
echo "Hostname: $(cat /etc/hostname)"
|
echo -e "${C3}Hostname: ${C4}$(cat /etc/hostname)"
|
||||||
echo "Kernel: $(uname -s) $(uname -r)"
|
echo -e "${C3}Kernel: ${C4}$(uname -s) $(uname -r)"
|
||||||
echo "Packages: $(get_packages)"
|
echo -e "${C3}Packages: ${C4}$(get_packages)"
|
||||||
echo "Shell: $(get_shell)"
|
echo -e "${C3}Shell: ${C4}$(get_shell)"
|
||||||
echo "CPU: $(get_cpu_name) ($(nproc) threads)"
|
echo -e "${C3}CPU: ${C4}$(get_cpu_name) ($(nproc) threads)"
|
||||||
if command_exists lshw; then
|
if command_exists lshw; then
|
||||||
echo "GPU: $(lshw -class display 2> /dev/null | grep 'product' | cut -d":" -f2 | xargs)"
|
echo -e "${C3}GPU: ${C4}$(lshw -class display 2> /dev/null | grep 'product' | cut -d":" -f2 | xargs)"
|
||||||
fi
|
fi
|
||||||
echo "Memory: $(get_used_mem) MiB / $(get_total_mem) MiB"
|
echo -e "${C3}Memory: ${C4}$(get_used_mem) MiB / $(get_total_mem) MiB"
|
||||||
if xhost >& /dev/null ; then
|
if xhost >& /dev/null ; then
|
||||||
echo "DE/WM: $(get_de_wm)"
|
if get_de_wm &> /dev/null; then
|
||||||
echo "Screen Resolution: $(get_screen_resolution)"
|
echo -e "${C3}DE/WM: ${C4}$(get_de_wm)"
|
||||||
|
fi
|
||||||
|
if command_exists xdpyinfo ; then
|
||||||
|
echo -e "${C3}Screen Resolution: ${C4}$(get_screen_resolution)"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ get_shell() {
|
|||||||
*)
|
*)
|
||||||
SHELL_NAME=${SHELL##*/}
|
SHELL_NAME=${SHELL##*/}
|
||||||
SHELL_VERSION="$($SHELL --version)"
|
SHELL_VERSION="$($SHELL --version)"
|
||||||
SHELL_VERSION=$(SHELL_VERSION//,//)
|
SHELL_VERSION=${SHELL_VERSION//","}
|
||||||
SHELL_VERSION=$(SHELL_VERSION// //)
|
SHELL_VERSION=${SHELL_VERSION//" "}
|
||||||
SHELL_VERSION=$(SHELL_VERSION//VERSION//)
|
SHELL_VERSION=${SHELL_VERSION//"version"}
|
||||||
SHELL_VERSION=$(SHELL_VERSION//"$SHELL_NAME"//)
|
SHELL_VERSION=${SHELL_VERSION//"$SHELL_NAME"}
|
||||||
echo "$SHELL_NAME $SHELL_VERSION"
|
echo "$SHELL_NAME $SHELL_VERSION"
|
||||||
unset SHELL_NAME
|
unset SHELL_NAME
|
||||||
unset SHELL_VERSION
|
unset SHELL_VERSION
|
||||||
@@ -51,15 +51,31 @@ get_used_mem() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_de_wm() {
|
get_de_wm() {
|
||||||
if [[ $DESKTOP_SESSION == "plasma" ]]; then
|
if ps -e | grep "plasmashell" &> /dev/null ; then
|
||||||
echo "KDE Plasma $(plasmashell --version | sed 's/plasmashell //g')"
|
echo "KDE Plasma $(plasmashell --version | awk '{print $2}')"
|
||||||
else
|
elif ps -e | grep "gnome-session" &> /dev/null ; then
|
||||||
|
echo "Gnome $(gnome-shell --version | awk '{print $3}')"
|
||||||
|
elif ps -e | grep "xfce4-session" &> /dev/null ; then
|
||||||
|
echo "XFCE $(xfce4-session --version | grep xfce4-session | awk '{print $2}')"
|
||||||
|
elif ps -e | grep "cinnamon" &> /dev/null ; then
|
||||||
|
echo "Cinnamon $(cinnamon --version | awk '{print $2}')"
|
||||||
|
elif ps -e | grep "mate-panel" &> /dev/null ; then
|
||||||
|
echo "Mate $(mate-about --version | awk '{print $4}')"
|
||||||
|
elif ps -e | grep "lxsession" &> /dev/null ; then
|
||||||
|
echo "LXDE"
|
||||||
|
elif ps -e | grep "sway" &> /dev/null ; then
|
||||||
|
echo "Sway $(sway --version | awk '{print $2}')"
|
||||||
|
elif ps -e | grep "icewm-session" &> /dev/null ; then
|
||||||
|
echo "IceWM $(icewm --version | awk '{print $2}' | sed 's/,//g')"
|
||||||
|
elif [ ! -z $DESKTOP_SESSION ]; then
|
||||||
echo "$DESKTOP_SESSION"
|
echo "$DESKTOP_SESSION"
|
||||||
|
else
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
get_screen_resolution() {
|
get_screen_resolution() {
|
||||||
if xhost >& /dev/null ;then
|
if xhost >& /dev/null && command_exists xdpyinfo; then
|
||||||
xdpyinfo | grep dimensions | tr -s ' ' | cut -d " " -f3
|
xdpyinfo | grep dimensions | tr -s ' ' | cut -d " " -f3
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,17 +7,28 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
|
"regexp"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var configPath = ""
|
var configPath = ""
|
||||||
var fetchScriptPath = ""
|
var fetchScriptPath = ""
|
||||||
|
|
||||||
var config = StormfetchConfig{}
|
var config = StormfetchConfig{
|
||||||
|
Ascii: "auto",
|
||||||
|
FetchScript: "auto",
|
||||||
|
AnsiiColors: make([]int, 0),
|
||||||
|
ForceConfigAnsii: false,
|
||||||
|
DependencyWarning: true,
|
||||||
|
}
|
||||||
|
|
||||||
type StormfetchConfig struct {
|
type StormfetchConfig struct {
|
||||||
Ascii string `yaml:"distro_ascii"`
|
Ascii string `yaml:"distro_ascii"`
|
||||||
FetchScript string `yaml:"fetch_script"`
|
FetchScript string `yaml:"fetch_script"`
|
||||||
|
AnsiiColors []int `yaml:"ansii_colors"`
|
||||||
|
ForceConfigAnsii bool `yaml:"force_config_ansii"`
|
||||||
|
DependencyWarning bool `yaml:"dependency_warning"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DistroInfo struct {
|
type DistroInfo struct {
|
||||||
@@ -67,10 +78,73 @@ func readConfig() {
|
|||||||
} else {
|
} else {
|
||||||
log.Fatalf("Fetch script file not found: %s", err.Error())
|
log.Fatalf("Fetch script file not found: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
// Show Dependency warning if enabled
|
||||||
|
if config.DependencyWarning {
|
||||||
|
dependencies := []string{"lshw", "xhost", "xdpyinfo"}
|
||||||
|
var missing []string
|
||||||
|
for _, depend := range dependencies {
|
||||||
|
if _, err := os.Stat(path.Join("/usr/bin/", depend)); err != nil {
|
||||||
|
missing = append(missing, depend)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(missing) != 0 {
|
||||||
|
fmt.Println("[WARNING] Stormfetch functionality may be limited due to the following dependencies not being installed:")
|
||||||
|
for _, depend := range missing {
|
||||||
|
fmt.Println(depend)
|
||||||
|
}
|
||||||
|
fmt.Println("You can disable this warning through your stormfetch config")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Fetch ascii art and apply colors
|
||||||
|
colorMap := make(map[string]string)
|
||||||
|
colorMap["C0"] = "\033[0m"
|
||||||
|
setColorMap := func() {
|
||||||
|
for i := 0; i < 6; i++ {
|
||||||
|
if i > len(config.AnsiiColors)-1 {
|
||||||
|
colorMap["C"+strconv.Itoa(i+1)] = "\033[0m"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
colorMap["C"+strconv.Itoa(i+1)] = fmt.Sprintf("\033[1m\033[38;5;%dm", config.AnsiiColors[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setColorMap()
|
||||||
|
ascii := ""
|
||||||
|
if strings.HasPrefix(getDistroAsciiArt(), "#/") {
|
||||||
|
firstLine := strings.Split(getDistroAsciiArt(), "\n")[0]
|
||||||
|
if !config.ForceConfigAnsii {
|
||||||
|
ansiiColors := strings.Split(strings.TrimPrefix(firstLine, "#/"), ";")
|
||||||
|
for i, color := range ansiiColors {
|
||||||
|
atoi, err := strconv.Atoi(color)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
if i < len(config.AnsiiColors) {
|
||||||
|
config.AnsiiColors[i] = atoi
|
||||||
|
} else {
|
||||||
|
config.AnsiiColors = append(config.AnsiiColors, atoi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setColorMap()
|
||||||
|
}
|
||||||
|
ascii = os.Expand(getDistroAsciiArt(), func(s string) string {
|
||||||
|
return colorMap[s]
|
||||||
|
})
|
||||||
|
ascii = strings.TrimPrefix(ascii, firstLine+"\n")
|
||||||
|
} else {
|
||||||
|
ascii = os.Expand(getDistroAsciiArt(), func(s string) string {
|
||||||
|
return colorMap[s]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
asciiSplit := strings.Split(ascii, "\n")
|
||||||
|
asciiNoColor := stripAnsii(ascii)
|
||||||
//Execute fetch script
|
//Execute fetch script
|
||||||
cmd := exec.Command("/bin/bash", fetchScriptPath)
|
cmd := exec.Command("/bin/bash", fetchScriptPath)
|
||||||
cmd.Dir = path.Dir(fetchScriptPath)
|
cmd.Dir = path.Dir(fetchScriptPath)
|
||||||
cmd.Env = os.Environ()
|
cmd.Env = os.Environ()
|
||||||
|
cmd.Env = append(cmd.Env, "C0=\033[0m")
|
||||||
|
for key, value := range colorMap {
|
||||||
|
cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", key, value))
|
||||||
|
}
|
||||||
cmd.Env = append(cmd.Env, "DISTRO_LONG_NAME="+getDistroInfo().LongName)
|
cmd.Env = append(cmd.Env, "DISTRO_LONG_NAME="+getDistroInfo().LongName)
|
||||||
cmd.Env = append(cmd.Env, "DISTRO_SHORT_NAME="+getDistroInfo().ShortName)
|
cmd.Env = append(cmd.Env, "DISTRO_SHORT_NAME="+getDistroInfo().ShortName)
|
||||||
out, err := cmd.Output()
|
out, err := cmd.Output()
|
||||||
@@ -78,22 +152,34 @@ func readConfig() {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
// Print Distro Information
|
// Print Distro Information
|
||||||
ascii := getDistroAscii()
|
|
||||||
maxWidth := 0
|
maxWidth := 0
|
||||||
for _, line := range strings.Split(ascii, "\n") {
|
for _, line := range strings.Split(asciiNoColor, "\n") {
|
||||||
if len(line) > maxWidth {
|
if len(line) > maxWidth {
|
||||||
maxWidth = len(line)
|
maxWidth = len(line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for lineIndex, line := range strings.Split(ascii, "\n") {
|
final := ""
|
||||||
for i := len(line); i < maxWidth+5; i++ {
|
for lineIndex, line := range asciiSplit {
|
||||||
|
lineVisibleLength := len(strings.Split(asciiNoColor, "\n")[lineIndex])
|
||||||
|
lastAsciiColor := ""
|
||||||
|
if lineIndex != 0 {
|
||||||
|
r := regexp.MustCompile("\033[38;5;[0-9]+m")
|
||||||
|
matches := r.FindAllString(asciiSplit[lineIndex-1], -1)
|
||||||
|
if len(matches) != 0 {
|
||||||
|
lastAsciiColor = r.FindAllString(asciiSplit[lineIndex-1], -1)[len(matches)-1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for i := lineVisibleLength; i < maxWidth+5; i++ {
|
||||||
line = line + " "
|
line = line + " "
|
||||||
}
|
}
|
||||||
if lineIndex < len(strings.Split(string(out), "\n")) {
|
asciiSplit[lineIndex] = lastAsciiColor + line
|
||||||
line = line + strings.Split(string(out), "\n")[lineIndex]
|
str := string(out)
|
||||||
|
if lineIndex < len(strings.Split(str, "\n")) {
|
||||||
|
line = line + colorMap["C0"] + strings.Split(str, "\n")[lineIndex]
|
||||||
}
|
}
|
||||||
fmt.Println(line)
|
final += lastAsciiColor + line + "\n"
|
||||||
}
|
}
|
||||||
|
fmt.Println(final)
|
||||||
}
|
}
|
||||||
|
|
||||||
func readKeyValueFile(filepath string) (map[string]string, error) {
|
func readKeyValueFile(filepath string) (map[string]string, error) {
|
||||||
@@ -158,7 +244,7 @@ func getDistroInfo() DistroInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDistroAscii() string {
|
func getDistroAsciiArt() string {
|
||||||
defaultAscii :=
|
defaultAscii :=
|
||||||
` .--.
|
` .--.
|
||||||
|o_o |
|
|o_o |
|
||||||
@@ -201,3 +287,9 @@ func getDistroAscii() string {
|
|||||||
return defaultAscii
|
return defaultAscii
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func stripAnsii(str string) string {
|
||||||
|
const ansi = "[\u001B\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
|
||||||
|
var re = regexp.MustCompile(ansi)
|
||||||
|
return re.ReplaceAllString(str, "")
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user