1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 07:52:50 -05:00

doctor: show compositor, quickshell and cli path in verbose

This commit is contained in:
LuckShiba
2025-12-28 15:08:36 -03:00
parent 05c7293b34
commit 170082751b

View File

@@ -169,12 +169,22 @@ func readOSRelease() map[string]string {
} }
func checkVersions(qsMissingFeatures bool) []checkResult { func checkVersions(qsMissingFeatures bool) []checkResult {
results := []checkResult{ dmsCliPath, _ := os.Executable()
{catVersions, "DMS CLI", "info", formatVersion(Version), ""}, dmsCliDetails := ""
if doctorVerbose {
dmsCliDetails = dmsCliPath
} }
qsVersion, qsStatus := getQuickshellVersionInfo(qsMissingFeatures) results := []checkResult{
results = append(results, checkResult{catVersions, "Quickshell", qsStatus, qsVersion, ""}) {catVersions, "DMS CLI", "ok", formatVersion(Version), dmsCliDetails},
}
qsVersion, qsStatus, qsPath := getQuickshellVersionInfo(qsMissingFeatures)
qsDetails := ""
if doctorVerbose && qsPath != "" {
qsDetails = qsPath
}
results = append(results, checkResult{catVersions, "Quickshell", qsStatus, qsVersion, qsDetails})
dmsVersion, dmsPath := getDMSShellVersion() dmsVersion, dmsPath := getDMSShellVersion()
if dmsVersion != "" { if dmsVersion != "" {
@@ -206,28 +216,30 @@ func getDMSShellVersion() (version, path string) {
return "", "" return "", ""
} }
func getQuickshellVersionInfo(missingFeatures bool) (string, string) { func getQuickshellVersionInfo(missingFeatures bool) (string, string, string) {
if !utils.CommandExists("qs") { if !utils.CommandExists("qs") {
return "Not installed", "error" return "Not installed", "error", ""
} }
qsPath, _ := exec.LookPath("qs")
output, err := exec.Command("qs", "--version").Output() output, err := exec.Command("qs", "--version").Output()
if err != nil { if err != nil {
return "Installed (version check failed)", "warn" return "Installed (version check failed)", "warn", qsPath
} }
fullVersion := strings.TrimSpace(string(output)) fullVersion := strings.TrimSpace(string(output))
if matches := regexp.MustCompile(`quickshell (\d+\.\d+\.\d+)`).FindStringSubmatch(fullVersion); len(matches) >= 2 { if matches := regexp.MustCompile(`quickshell (\d+\.\d+\.\d+)`).FindStringSubmatch(fullVersion); len(matches) >= 2 {
if version.CompareVersions(matches[1], "0.2.0") < 0 { if version.CompareVersions(matches[1], "0.2.0") < 0 {
return fmt.Sprintf("%s (needs >= 0.2.0)", fullVersion), "error" return fmt.Sprintf("%s (needs >= 0.2.0)", fullVersion), "error", qsPath
} }
if missingFeatures { if missingFeatures {
return fullVersion, "warn" return fullVersion, "warn", qsPath
} }
return fullVersion, "ok" return fullVersion, "ok", qsPath
} }
return fullVersion, "warn" return fullVersion, "warn", qsPath
} }
func checkDMSInstallation() []checkResult { func checkDMSInstallation() []checkResult {
@@ -287,9 +299,20 @@ func checkWindowManagers() []checkResult {
for _, c := range compositors { for _, c := range compositors {
if slices.ContainsFunc(c.commands, utils.CommandExists) { if slices.ContainsFunc(c.commands, utils.CommandExists) {
foundAny = true foundAny = true
var compositorPath string
for _, cmd := range c.commands {
if path, err := exec.LookPath(cmd); err == nil {
compositorPath = path
break
}
}
details := ""
if doctorVerbose && compositorPath != "" {
details = compositorPath
}
results = append(results, checkResult{ results = append(results, checkResult{
catCompositor, c.name, "ok", catCompositor, c.name, "ok",
getVersionFromCommand(c.versionCmd, c.versionArg, c.versionRe), "", getVersionFromCommand(c.versionCmd, c.versionArg, c.versionRe), details,
}) })
} }
} }