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