mirror of
https://github.com/EnumeratedDev/stormfetch.git
synced 2026-09-24 19:56:12 +00:00
Compare commits
6
Commits
983b347d88
...
7.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cafe93b33
|
||
|
|
adcf06c149
|
||
|
|
5ef39f89cc
|
||
|
|
738d2c2086
|
||
|
|
637bd2c3e3 | ||
|
|
08035010c9
|
@@ -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
|
||||

|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 12 MiB |
+12
-4
@@ -24,7 +24,8 @@ type GPU struct {
|
||||
Product string
|
||||
Subsystem string
|
||||
Driver string
|
||||
VRAM string
|
||||
VramTotal string
|
||||
VramUsed string
|
||||
}
|
||||
|
||||
type Monitor struct {
|
||||
@@ -136,11 +137,17 @@ func GetGPUModels(hiddenGPUs []int) []GPU {
|
||||
}
|
||||
|
||||
// Get VRAM
|
||||
vram := "Unknown"
|
||||
vramTotal := "Unknown"
|
||||
bytes, err := os.ReadFile("/sys/class/drm/card" + strconv.Itoa(gpu.Index) + "/device/mem_info_vram_total")
|
||||
if err == nil {
|
||||
vramUint, _ := strconv.ParseUint(strings.TrimSpace(string(bytes)), 10, 64)
|
||||
vram = FormatBytes(vramUint)
|
||||
vramTotal = FormatBytes(vramUint)
|
||||
}
|
||||
vramUsed := "Unknown"
|
||||
bytes, err = os.ReadFile("/sys/class/drm/card" + strconv.Itoa(gpu.Index) + "/device/mem_info_vram_used")
|
||||
if err == nil {
|
||||
vramUint, _ := strconv.ParseUint(strings.TrimSpace(string(bytes)), 10, 64)
|
||||
vramUsed = FormatBytes(vramUint)
|
||||
}
|
||||
|
||||
ret = append(ret, GPU{
|
||||
@@ -150,7 +157,8 @@ func GetGPUModels(hiddenGPUs []int) []GPU {
|
||||
Product: gpu.DeviceInfo.Product.Name,
|
||||
Subsystem: gpu.DeviceInfo.Subsystem.Name,
|
||||
Driver: gpu.DeviceInfo.Driver,
|
||||
VRAM: vram,
|
||||
VramTotal: vramTotal,
|
||||
VramUsed: vramUsed,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
+9
-2
@@ -246,8 +246,10 @@ func initializeModuleMap() {
|
||||
return gpu.Subsystem
|
||||
case "GPU_DRIVER":
|
||||
return gpu.Driver
|
||||
case "GPU_VRAM":
|
||||
return gpu.VRAM
|
||||
case "GPU_VRAM_TOTAL":
|
||||
return gpu.VramTotal
|
||||
case "GPU_VRAM_USED":
|
||||
return gpu.VramUsed
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
@@ -356,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":
|
||||
|
||||
Reference in New Issue
Block a user