4 Commits
7 changed files with 51 additions and 10 deletions
+2
View File
@@ -34,3 +34,5 @@ run: build/stormfetch
clean:
rm -r build/
.PHONY: build
+19
View File
@@ -0,0 +1,19 @@
#/2;36;72;15
${C2}:::::----:::::
${C2}::----------------::=
${C2}:-------------------::
${C1} : ${C2}:::. ..:-------:
${C1} =*=. ${C2}.:-----:
${C1} =****- ${C2}:-----:
${C1}=*****- ${C2}:::::: :-----:
${C1}=****+ ${C2}:--------: :----:
${C1}+****- ${C2}.----------. :----:
${C1}+****- ${C2}.----------. :-----
${C1}=****+ ${C2}:--------: :----:
${C1}=*****- ${C2}:::::: :-----:
${C1} =*****- ${C2}:----:
${C1} =*****+: ${C2}:-:
${C1} =*******=:: ::=-. ${C2}.
${C1} ==*******************-
${C1} ===****************=-
${C1} ===+=****++===
+1
View File
@@ -3,3 +3,4 @@ fetch_script: auto
ansii_colors: []
force_config_ansii: false
dependency_warning: true
hidden_gpus: []
+4 -1
View File
@@ -6,7 +6,10 @@ echo -e "${C3}Kernel: ${C4}$(uname -s) $(uname -r)"
echo -e "${C3}Packages: ${C4}$(get_packages)"
echo -e "${C3}Shell: ${C4}${USER_SHELL}"
if [ ! -z "$CPU_MODEL" ]; then echo -e "${C3}CPU: ${C4}${CPU_MODEL} (${CPU_THREADS} threads)"; fi
if [ ! -z "$GPU_MODEL" ]; then echo -e "${C3}GPU: ${C4}${GPU_MODEL}"; fi
for i in $(seq ${CONNECTED_GPUS}); do
gpu="GPU$i"
echo -e "${C3}GPU: ${C4}${!gpu}"
done
if [ ! -z "$MEM_TOTAL" ] && [ ! -z "$MEM_USED" ]; then echo -e "${C3}Memory: ${C4}${MEM_USED} MiB / ${MEM_TOTAL} MiB"; fi
for i in $(seq ${MOUNTED_PARTITIONS}); do
device="PARTITION${i}_DEVICE"
+4 -1
View File
@@ -20,11 +20,14 @@ get_packages() {
if command_exists rpm; then
ARRAY+=("$(rpm -qa | wc -l) (rpm)")
fi
if command_exists xbps-query; then
ARRAY+=("$(xbps-query -l | wc -l) (xbps)")
fi
if command_exists bpm; then
ARRAY+=("$(bpm list -n) (bpm)")
fi
if command_exists emerge; then
ARRAY+=("$(ls -l /var/db/pkg/ | wc -l) (emerge)")
ARRAY+=("$(ls -l /var/db/pkg/* | wc -l) (emerge)")
fi
if command_exists flatpak; then
ARRAY+=("$(flatpak list | wc -l) (flatpak)")
+11 -2
View File
@@ -22,6 +22,7 @@ var config = StormfetchConfig{
AnsiiColors: make([]int, 0),
ForceConfigAnsii: false,
DependencyWarning: true,
HiddenGPUS: make([]int, 0),
}
type StormfetchConfig struct {
@@ -31,6 +32,7 @@ type StormfetchConfig struct {
AnsiiColors []int `yaml:"ansii_colors"`
ForceConfigAnsii bool `yaml:"force_config_ansii"`
DependencyWarning bool `yaml:"dependency_warning"`
HiddenGPUS []int `yaml:"hidden_gpus"`
}
func main() {
@@ -141,8 +143,15 @@ func SetupFetchEnv() []string {
env["MONITOR"+strconv.Itoa(i+1)] = monitor
}
}
if getGPUName() != "" {
env["GPU_MODEL"] = getGPUName()
gpus := getGPUNames()
if len(gpus) != 0 {
env["CONNECTED_GPUS"] = strconv.Itoa(len(gpus))
for i, gpu := range gpus {
if gpu == "" {
continue
}
env["GPU"+strconv.Itoa(i+1)] = gpu
}
}
var ret = make([]string, len(env))
+9 -5
View File
@@ -119,7 +119,8 @@ func getCPUThreads() int {
return int(cpu.TotalThreads)
}
func getGPUName() string {
func getGPUNames() []string {
var ret []string
null, _ := os.Open(os.DevNull)
serr := os.Stderr
os.Stderr = null
@@ -127,14 +128,17 @@ func getGPUName() string {
defer null.Close()
os.Stderr = serr
if err != nil {
return ""
return nil
}
for _, graphics := range gpu.GraphicsCards {
for i, graphics := range gpu.GraphicsCards {
if slices.Contains(config.HiddenGPUS, i+1) {
continue
}
if graphics.DeviceInfo != nil {
return graphics.DeviceInfo.Product.Name
ret = append(ret, graphics.DeviceInfo.Product.Name)
}
}
return ""
return ret
}
type Memory struct {