diff --git a/README.md b/README.md index 3a3fd54..8371c6f 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Stormfetch is still in beta and distro compatibility is limited. If you would li - Download `go` from your package manager or from the go website - Download `make` from your package manager - (Optional) Download `xorg-xhost` from your package manager to display DE/WM and monitor information +- (Optional) Download `xorg-xdpyinfo` from your package manager to display Screen Resolution - (Optional) Download `lshw` from your package manager to display GPU information - Run the following command to compile the project ``` diff --git a/config/config.yaml b/config/config.yaml index 9146622..4007a4b 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -1,2 +1,3 @@ distro_ascii: auto fetch_script: auto +dependency_warning: true \ No newline at end of file diff --git a/main.go b/main.go index 24d4c9a..c2eb984 100644 --- a/main.go +++ b/main.go @@ -16,8 +16,9 @@ var fetchScriptPath = "" var config = StormfetchConfig{} type StormfetchConfig struct { - Ascii string `yaml:"distro_ascii"` - FetchScript string `yaml:"fetch_script"` + Ascii string `yaml:"distro_ascii"` + FetchScript string `yaml:"fetch_script"` + DependencyWarning bool `yaml:"dependency_warning"` } type DistroInfo struct { @@ -67,6 +68,23 @@ func readConfig() { } else { log.Fatalf("Fetch script file not found: %s", err.Error()) } + // Show Dependency warning if enabled + if config.DependencyWarning { + dependencies := []string{"lshw", "xhost", "xdpyinfo"} + var missing []string + for _, depend := range dependencies { + if _, err := os.Stat(path.Join("/usr/bin/", depend)); err != nil { + missing = append(missing, depend) + } + } + if len(missing) != 0 { + fmt.Println("[WARNING] Stormfetch functionality may be limited due to the following dependencies not being installed:") + for _, depend := range missing { + fmt.Println(depend) + } + fmt.Println("You can disable this warning through your stormfetch config") + } + } //Execute fetch script cmd := exec.Command("/bin/bash", fetchScriptPath) cmd.Dir = path.Dir(fetchScriptPath)