mirror of
https://github.com/EnumeratedDev/stormfetch.git
synced 2026-09-16 07:56:12 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ed976a06e | ||
|
|
ce9813a2af | ||
|
|
0d3d3fafb2 | ||
|
|
a99defd401 | ||
|
|
f34537eb5a | ||
|
|
120a1cf8e4 |
@@ -1,3 +1,5 @@
|
|||||||
|
SHELL := /bin/bash
|
||||||
|
|
||||||
ifeq ($(PREFIX),)
|
ifeq ($(PREFIX),)
|
||||||
PREFIX := /usr/local
|
PREFIX := /usr/local
|
||||||
endif
|
endif
|
||||||
@@ -35,4 +37,4 @@ run: build/stormfetch
|
|||||||
clean:
|
clean:
|
||||||
rm -r build/
|
rm -r build/
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
## A simple linux fetch program written in go and bash
|
## A simple linux fetch program written in go and bash
|
||||||
|
|
||||||
### Developers:
|
### Developers:
|
||||||
- [CapCreeperGR ](https://gitlab.com/CapCreeperGR)
|
- [EnumDev](https://gitlab.com/EnumDev)
|
||||||
|
|
||||||
### Project Information
|
### Project Information
|
||||||
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 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.
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ echo -e "${C3}Packages: ${C4}$(get_packages)"
|
|||||||
echo -e "${C3}Shell: ${C4}${USER_SHELL}"
|
echo -e "${C3}Shell: ${C4}${USER_SHELL}"
|
||||||
echo -e "${C3}Init: ${C4}${INIT_SYSTEM}"
|
echo -e "${C3}Init: ${C4}${INIT_SYSTEM}"
|
||||||
echo -e "${C3}Libc: ${C4}${LIBC}"
|
echo -e "${C3}Libc: ${C4}${LIBC}"
|
||||||
|
[ -n "$MOTHERBOARD" ] && echo -e "${C3}Motherboard: ${C4}${MOTHERBOARD}"
|
||||||
[ -n "$CPU_MODEL" ] && echo -e "${C3}CPU: ${C4}${CPU_MODEL} (${CPU_THREADS} threads)"
|
[ -n "$CPU_MODEL" ] && echo -e "${C3}CPU: ${C4}${CPU_MODEL} (${CPU_THREADS} threads)"
|
||||||
for i in $(seq "${CONNECTED_GPUS}"); do
|
for i in $(seq "${CONNECTED_GPUS}"); do
|
||||||
gpu="GPU$i"
|
gpu="GPU$i"
|
||||||
@@ -42,3 +43,6 @@ if [ -n "$DISPLAY_PROTOCOL" ]; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
[ -n "$DE_WM" ] && echo -e "${C3}DE/WM: ${C4}${DE_WM}"
|
[ -n "$DE_WM" ] && echo -e "${C3}DE/WM: ${C4}${DE_WM}"
|
||||||
|
|
||||||
|
# Exiting with error code 0 in case the condition above returns 1
|
||||||
|
exit 0
|
||||||
@@ -128,6 +128,7 @@ func SetupFetchEnv(showTimeTaken bool) []string {
|
|||||||
setVariable("DISTRO_LONG_NAME", func() string { return getDistroInfo().LongName })
|
setVariable("DISTRO_LONG_NAME", func() string { return getDistroInfo().LongName })
|
||||||
setVariable("DISTRO_SHORT_NAME", func() string { return getDistroInfo().ShortName })
|
setVariable("DISTRO_SHORT_NAME", func() string { return getDistroInfo().ShortName })
|
||||||
setVariable("CPU_MODEL", func() string { return getCPUName() })
|
setVariable("CPU_MODEL", func() string { return getCPUName() })
|
||||||
|
setVariable("MOTHERBOARD", func() string { return getMotherboardModel() })
|
||||||
setVariable("CPU_THREADS", func() string { return strconv.Itoa(getCPUThreads()) })
|
setVariable("CPU_THREADS", func() string { return strconv.Itoa(getCPUThreads()) })
|
||||||
start := time.Now().UnixMilli()
|
start := time.Now().UnixMilli()
|
||||||
memory := GetMemoryInfo()
|
memory := GetMemoryInfo()
|
||||||
@@ -259,7 +260,7 @@ func runStormfetch() {
|
|||||||
}
|
}
|
||||||
out, err := cmd.Output()
|
out, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatalf("Error: Could not run fetch script: %s", err)
|
||||||
}
|
}
|
||||||
// Print Distro Information
|
// Print Distro Information
|
||||||
maxWidth := 0
|
maxWidth := 0
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ func getDistroAsciiArt() string {
|
|||||||
}
|
}
|
||||||
userConfDir, err := os.UserConfigDir()
|
userConfDir, err := os.UserConfigDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if _, err := os.Stat(path.Join("/etc/stormfetch/ascii/", id)); err == nil {
|
if _, err := os.Stat(path.Join(systemConfigDir, "stormfetch/ascii/", id)); err == nil {
|
||||||
bytes, err := os.ReadFile(path.Join("/etc/stormfetch/ascii/", id))
|
bytes, err := os.ReadFile(path.Join(systemConfigDir, "stormfetch/ascii/", id))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return defaultAscii
|
return defaultAscii
|
||||||
}
|
}
|
||||||
@@ -89,8 +89,8 @@ func getDistroAsciiArt() string {
|
|||||||
return defaultAscii
|
return defaultAscii
|
||||||
}
|
}
|
||||||
return string(bytes)
|
return string(bytes)
|
||||||
} else if _, err := os.Stat(path.Join("/etc/stormfetch/ascii/", id)); err == nil {
|
} else if _, err := os.Stat(path.Join(systemConfigDir, "stormfetch/ascii/", id)); err == nil {
|
||||||
bytes, err := os.ReadFile(path.Join("/etc/stormfetch/ascii/", id))
|
bytes, err := os.ReadFile(path.Join(systemConfigDir, "stormfetch/ascii/", id))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return defaultAscii
|
return defaultAscii
|
||||||
}
|
}
|
||||||
@@ -100,6 +100,14 @@ func getDistroAsciiArt() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getMotherboardModel() string {
|
||||||
|
bytes, err := os.ReadFile("/sys/devices/virtual/dmi/id/board_name")
|
||||||
|
if err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return strings.TrimSpace(string(bytes))
|
||||||
|
}
|
||||||
|
|
||||||
func getCPUName() string {
|
func getCPUName() string {
|
||||||
cpu, err := ghw.CPU()
|
cpu, err := ghw.CPU()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -236,7 +244,7 @@ func GetShell() string {
|
|||||||
func GetDEWM() string {
|
func GetDEWM() string {
|
||||||
processes, err := ps.Processes()
|
processes, err := ps.Processes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatalf("Error: could not get processes: %s", err)
|
||||||
}
|
}
|
||||||
var executables []string
|
var executables []string
|
||||||
for _, process := range processes {
|
for _, process := range processes {
|
||||||
@@ -265,7 +273,7 @@ func GetDEWM() string {
|
|||||||
} else if processExists("gnome-session") {
|
} else if processExists("gnome-session") {
|
||||||
return "Gnome " + runCommand("gnome-shell --version | awk '{print $3}'")
|
return "Gnome " + runCommand("gnome-shell --version | awk '{print $3}'")
|
||||||
} else if processExists("xfce4-session") {
|
} else if processExists("xfce4-session") {
|
||||||
return "XFCE " + runCommand("xfce4-session --version | grep xfce4-session | awk '{print $2}'")
|
return "XFCE " + runCommand("xfce4-session --version | head -n1 | awk '{print $2}'")
|
||||||
} else if processExists("cinnamon") {
|
} else if processExists("cinnamon") {
|
||||||
return "Cinnamon " + runCommand("cinnamon --version | awk '{print $3}'")
|
return "Cinnamon " + runCommand("cinnamon --version | awk '{print $3}'")
|
||||||
} else if processExists("mate-panel") {
|
} else if processExists("mate-panel") {
|
||||||
|
|||||||
Reference in New Issue
Block a user