Compare commits

..
Author SHA1 Message Date
EnumDev a919ffb71b Fix multiple spaces when version number is empty 2026-02-16 15:18:12 +02:00
EnumDev 8147d302c8 Fix bash version checking 2026-02-16 14:15:59 +02:00
EnumDev 8dfe7b3a0e Return unknown GPU if device info is nil 2026-02-16 14:12:19 +02:00
EnumDev 8cafe93b33 Update README.md 2026-02-15 20:12:48 +02:00
EnumDev adcf06c149 Reduce gif quality for faster playback 2026-02-15 19:55:49 +02:00
EnumDev 5ef39f89cc Update preview gif 2026-02-15 19:52:35 +02:00
EnumDev 738d2c2086 Disale local IP module if no ip is available 2026-02-15 19:42:18 +02:00
EnumDevandGitHub 637bd2c3e3 Merge pull request #1 from EnumeratedDev/experimental
Merge experimental changes
2026-02-15 17:39:04 +00:00
6 changed files with 147 additions and 62 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
### 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 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.
At the moment ascii art for different distributions is limited. If you would like to contribute ascii art feel free to make a pull request.
### How it looks
![Stormfetch gif](media/stormfetch.gif)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 12 MiB

+16
View File
@@ -92,8 +92,24 @@ func GetGPUModels(hiddenGPUs []int) []GPU {
continue
}
// Check if device info is set
if gpu.DeviceInfo == nil {
ret = append(ret, GPU{
PCIAddress: gpu.Address,
Vendor: "Unknown",
Name: "GPU",
Product: "Unknown",
Subsystem: "Unknown",
Driver: "Unknown",
VramTotal: "Unknown",
VramUsed: "Unknown",
})
continue
}
// Set alternative names for vendors
var vendor string
switch gpu.DeviceInfo.Vendor.ID {
case "1002":
vendor = "AMD"
+6 -3
View File
@@ -358,6 +358,11 @@ func initializeModuleMap() {
localIpModule := StormfetchModule{stormfetchModuleConfig: stormfetchModuleConfig{Name: "local_ip", Format: "%3Local IP: %4$LOCAL_IP"}, Execute: func(sm StormfetchModule) string {
localIP := GetLocalIP()
// Return empty string if local IP is unavailable
if localIP == "Unknown" {
return ""
}
return os.Expand(sm.Format, func(s string) string {
switch s {
case "LOCAL_IP":
@@ -370,7 +375,7 @@ func initializeModuleMap() {
RegisterModule(localIpModule)
// DEWM module
dewmModule := StormfetchModule{stormfetchModuleConfig: stormfetchModuleConfig{Name: "de_wm", Format: "%3${DEWM_TYPE}: %4${DEWM_NAME} ${DEWM_VERSION} ($DISPLAY_PROTOCOL)"}, Execute: func(sm StormfetchModule) string {
dewmModule := StormfetchModule{stormfetchModuleConfig: stormfetchModuleConfig{Name: "de_wm", Format: "%3${DEWM_TYPE}: %4${DEWM_NAME} ($DISPLAY_PROTOCOL)"}, Execute: func(sm StormfetchModule) string {
// Return empty string if currently in TTY
if os.Getenv("XDG_SESSION_TYPE") == "" || os.Getenv("XDG_SESSION_TYPE") == "tty" {
return ""
@@ -390,8 +395,6 @@ func initializeModuleMap() {
return dewm.Name
case "DEWM_TYPE":
return dewm.Type
case "DEWM_VERSION":
return dewm.Version
case "DISPLAY_PROTOCOL":
return displayProtocol
default:
+22 -8
View File
@@ -146,21 +146,35 @@ func GetInitSystem() string {
// Special cases
// OpenRC check
if _, err := os.Stat("/usr/sbin/openrc"); err == nil {
return "OpenRC " + runCommand("openrc --version | awk '{print $3}'", "/bin/sh")
openrcVersion := runCommand("openrc --version | awk '{print $3}'", "/bin/sh")
if openrcVersion != "" {
return "OpenRC " + openrcVersion
} else {
return "OpenRC"
}
}
// Default PID 1 process name checking
switch process.Executable() {
initName := process.Executable()
initVersion := ""
switch initName {
case "systemd":
return "Systemd " + runCommand("systemctl --version | head -n1 | awk '{print $2}'", "/bin/sh")
initName = "Systemd"
initVersion = runCommand("systemctl --version | head -n1 | awk '{print $2}'", "/bin/sh")
case "runit":
return "Runit"
initName = "Runit"
case "dinit":
return "Dinit " + runCommand("dinit --version | head -n1 | awk '{print substr($3, 1, length($3)-1)}'", "/bin/sh")
initName = "Dinit"
initVersion = runCommand("dinit --version | head -n1 | awk '{print substr($3, 1, length($3)-1)}'", "/bin/sh")
case "enit":
return "Enit " + runCommand("enit --version | awk '{print $3}'", "/bin/sh")
default:
return process.Executable()
initName = "Enit"
initVersion = runCommand("enit --version | awk '{print $3}'", "/bin/sh")
}
if initVersion != "" {
return initName + " " + initVersion
} else {
return initName
}
}
+74 -22
View File
@@ -14,7 +14,6 @@ import (
type DEWM struct {
Name string
Type string
Version string
}
func GetShell() string {
@@ -34,21 +33,30 @@ func GetShell() string {
shell = userInfo[6]
}
}
shellName := filepath.Base(shell)
switch shellName {
case "dash":
return "Dash"
shellName := "Unknown"
shellVersion := ""
switch filepath.Base(shell) {
case "bash":
return "Bash " + runCommand("echo $BASH_VERSION", "/bin/sh")
shellName = "Bash"
shellVersion = runCommand("$SHELL --version | head -n1 | awk '{print $4}'", "/bin/sh")
case "zsh":
return "Zsh " + runCommand("$SHELL --version | awk '{print $2}'", "/bin/sh")
shellName = "Zsh"
shellVersion = runCommand("$SHELL --version | awk '{print $2}'", "/bin/sh")
case "fish":
return "Fish " + runCommand("$SHELL --version | awk '{print $3}'", "/bin/sh")
shellName = "Fish"
shellVersion = runCommand("$SHELL --version | awk '{print $3}'", "/bin/sh")
case "nu":
return "Nushell " + runCommand("$SHELL --version", "/bin/sh")
shellName = "Nushell"
shellVersion = runCommand("$SHELL --version", "/bin/sh")
default:
return "Unknown"
}
if shellVersion != "" {
return shellName + " " + shellVersion
} else {
return shellName
}
}
func GetDEWM() DEWM {
@@ -68,96 +76,140 @@ func GetDEWM() DEWM {
dewm := DEWM{
Name: "KDE Plasma",
Type: "DE",
Version: runCommand("plasmashell --version | awk '{print $2}'", "/bin/sh"),
}
if version := runCommand("plasmashell --version | awk '{print $2}'", "/bin/sh"); version != "" {
dewm.Name += " " + version
}
return dewm
} else if processExists("gnome-session") {
dewm := DEWM{
Name: "Gnome",
Type: "DE",
Version: runCommand("gnome-shell --version | awk '{print $3}'", "/bin/sh"),
}
if version := runCommand("gnome-shell --version | awk '{print $3}'", "/bin/sh"); version != "" {
dewm.Name += " " + version
}
return dewm
} else if processExists("xfce4-session") {
dewm := DEWM{
Name: "XFCE",
Type: "DE",
Version: runCommand("xfce4-session --version | head -n1 | awk '{print $2}'", "/bin/sh"),
}
if version := runCommand("xfce4-session --version | head -n1 | awk '{print $2}'", "/bin/sh"); version != "" {
dewm.Name += " " + version
}
return dewm
} else if processExists("cinnamon") {
dewm := DEWM{
Name: "Cinnamon",
Type: "DE",
Version: runCommand("cinnamon --version | awk '{print $3}'", "/bin/sh"),
}
if version := runCommand("cinnamon --version | awk '{print $3}'", "/bin/sh"); version != "" {
dewm.Name += " " + version
}
return dewm
} else if processExists("mate-panel") {
dewm := DEWM{
Name: "MATE",
Type: "DE",
Version: runCommand("mate-about --version | awk '{print $4}'", "/bin/sh"),
}
if version := runCommand("mate-about --version | awk '{print $4}'", "/bin/sh"); version != "" {
dewm.Name += " " + version
}
return dewm
} else if processExists("lxsession") {
dewm := DEWM{
Name: "LXDE",
Type: "DE",
Version: "",
}
return dewm
} else if processExists("lxqt-session") {
dewm := DEWM{
Name: "LXQt",
Type: "DE",
Version: runCommand("lxqt-session --version | head -n1 | awk '{print $2}'", "/bin/sh"),
}
if version := runCommand("lxqt-session --version | head -n1 | awk '{print $2}'", "/bin/sh"); version != "" {
dewm.Name += " " + version
}
return dewm
} else if processExists("i3") || processExists("i3-with-shmlog") {
dewm := DEWM{
Name: "i3",
Type: "WM",
Version: runCommand("i3 --version | awk '{print $3}'", "/bin/sh"),
}
if version := runCommand("i3 --version | awk '{print $3}'", "/bin/sh"); version != "" {
dewm.Name += " " + version
}
return dewm
} else if processExists("sway") {
dewm := DEWM{
Name: "Sway",
Type: "WM",
Version: runCommand("sway --version | awk '{print $3}'", "/bin/sh"),
}
if runCommand("sway --version | awk '{print $1}'", "/bin/sh") == "swayfx" {
dewm.Name = "SwayFX"
} else {
dewm.Name = "Sway"
}
if version := runCommand("sway --version | awk '{print $3}'", "/bin/sh"); version != "" {
dewm.Name += " " + version
}
return dewm
} else if processExists("bspwm") {
dewm := DEWM{
Name: "Bspwm",
Type: "WM",
Version: runCommand("bspwm -v", "/bin/sh"),
}
if version := runCommand("bspwm -v", "/bin/sh"); version != "" {
dewm.Name += " " + version
}
return dewm
} else if processExists("Hyprland") {
dewm := DEWM{
Name: "Hyprland",
Type: "WM",
Version: runCommand("hyprctl version | sed -n 3p | awk '{print $2}' | tr -d 'v,'", "/bin/sh"),
}
if version := runCommand("hyprctl version | sed -n 3p | awk '{print $2}' | tr -d 'v,'", "/bin/sh"); version != "" {
dewm.Name += " " + version
}
return dewm
} else if processExists("icewm-session") {
dewm := DEWM{
Name: "IceWM",
Type: "WM",
Version: runCommand("icewm --version | awk '{print $2}'", "/bin/sh"),
}
if version := runCommand("icewm --version | awk '{print $2}'", "/bin/sh"); version != "" {
dewm.Name += " " + version
}
return dewm
}
return DEWM{
Name: "Unknown",
Type: "Unknown",
Version: "Unknown",
}
}