mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-31 07:27:47 -04:00
fix: doctor retired package check nd flashbang
fixes #4042
fixes #4041
port 2.0
(cherry picked from commit 390de93432)
This commit is contained in:
1 parent
78183cdb27
commit
aa42914ae8
7 files changed
+46
-7
No files matched your search
@@ -1700,18 +1700,15 @@ func greeterFlagValue(fields []string, flags ...string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
var retiredGreeterPackages = []string{"greetd-dms-greeter", "greetd-dms-greeter-bin", "greetd-dms-greeter-git"}
|
||||
|
||||
func checkRetiredGreeterPackages() []checkResult {
|
||||
if !utils.CommandExists("pacman") {
|
||||
return nil
|
||||
}
|
||||
// pacman -Q exits non-zero when any name is missing but still lists the installed ones
|
||||
out, _ := exec.Command("pacman", "-Q", "greetd-dms-greeter", "greetd-dms-greeter-bin", "greetd-dms-greeter-git").Output()
|
||||
var installed []string
|
||||
for line := range strings.SplitSeq(strings.TrimSpace(string(out)), "\n") {
|
||||
if name, _, _ := strings.Cut(line, " "); name != "" {
|
||||
installed = append(installed, name)
|
||||
}
|
||||
}
|
||||
out, _ := exec.Command("pacman", append([]string{"-Q"}, retiredGreeterPackages...)...).Output()
|
||||
installed := retiredGreeterPackagesInstalled(string(out))
|
||||
if len(installed) == 0 {
|
||||
return nil
|
||||
}
|
||||
@@ -1723,6 +1720,19 @@ func checkRetiredGreeterPackages() []checkResult {
|
||||
}}
|
||||
}
|
||||
|
||||
// pacman -Q answers a missing name with any installed package that provides it,
|
||||
// so the dux-greeter successors come back under the retired names they provide.
|
||||
func retiredGreeterPackagesInstalled(pacmanQuery string) []string {
|
||||
var installed []string
|
||||
for line := range strings.SplitSeq(strings.TrimSpace(pacmanQuery), "\n") {
|
||||
name, _, _ := strings.Cut(line, " ")
|
||||
if slices.Contains(retiredGreeterPackages, name) {
|
||||
installed = append(installed, name)
|
||||
}
|
||||
}
|
||||
return installed
|
||||
}
|
||||
|
||||
// Chromium, Electron and libadwaita follow light/dark through the settings
|
||||
// portal; without it they fall back to GTK theme colours that never update.
|
||||
func checkSettingsPortal() []checkResult {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"encoding/binary"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
@@ -497,3 +498,21 @@ func TestCheckGreetdSession(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRetiredGreeterPackagesInstalled(t *testing.T) {
|
||||
tests := map[string]struct {
|
||||
query string
|
||||
want []string
|
||||
}{
|
||||
"dux successor satisfying the retired names": {"dux-greeter-git 2.0.0.r165.g7cf13f1-1\ndux-greeter-git 2.0.0.r165.g7cf13f1-1\ndux-greeter-git 2.0.0.r165.g7cf13f1-1\n", nil},
|
||||
"retired package still installed": {"greetd-dms-greeter-git 1:1.6.2.r0.g0175be5-1\ngreetd-dms-greeter-git 1:1.6.2.r0.g0175be5-1\n", []string{"greetd-dms-greeter-git", "greetd-dms-greeter-git"}},
|
||||
"nothing installed": {"", nil},
|
||||
}
|
||||
for name, tc := range tests {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
if got := retiredGreeterPackagesInstalled(tc.query); !slices.Equal(got, tc.want) {
|
||||
t.Fatalf("got %v, want %v", got, tc.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,8 @@ DFloatingWindow {
|
||||
|
||||
objectName: "changelogModal"
|
||||
title: I18n.tr("What's New", "changelog window title")
|
||||
implicitWidth: modalWidth
|
||||
implicitHeight: modalHeight
|
||||
minimumSize: Qt.size(modalWidth, modalHeight)
|
||||
maximumSize: Qt.size(modalWidth, modalHeight)
|
||||
visible: false
|
||||
|
||||
@@ -87,6 +87,8 @@ DFloatingWindow {
|
||||
|
||||
objectName: "greeterModal"
|
||||
title: I18n.tr("Welcome", "greeter modal window title")
|
||||
implicitWidth: modalWidth
|
||||
implicitHeight: modalHeight
|
||||
minimumSize: Qt.size(modalWidth, modalHeight)
|
||||
maximumSize: Qt.size(modalWidth, modalHeight)
|
||||
visible: false
|
||||
|
||||
@@ -38,6 +38,8 @@ DFloatingWindow {
|
||||
title: I18n.tr("Authentication", "noun, polkit dialog title and settings section title")
|
||||
minimumSize: Qt.size(Theme.dialogMaxWidth, Math.min((screen?.height ?? 1080) - Theme.spacingXL * 2, Math.max(220, contentLoader.item?.implicitHeight ?? 0)))
|
||||
maximumSize: minimumSize
|
||||
implicitWidth: minimumSize.width
|
||||
implicitHeight: minimumSize.height
|
||||
visible: false
|
||||
|
||||
onClosed: cancelAuth()
|
||||
|
||||
@@ -15,6 +15,8 @@ DFloatingWindow {
|
||||
title: editor.title
|
||||
minimumSize: Qt.size(Math.min(SettingsMetrics.formDialogWidth + Theme.spacingL * 2, Screen.width), Math.min(Math.round(Theme.fontSizeMedium * 52), Screen.height))
|
||||
maximumSize: minimumSize
|
||||
implicitWidth: minimumSize.width
|
||||
implicitHeight: minimumSize.height
|
||||
visible: false
|
||||
|
||||
onClosed: hide()
|
||||
|
||||
@@ -15,6 +15,8 @@ DFloatingWindow {
|
||||
title: I18n.tr("Rename Workspace")
|
||||
minimumSize: Qt.size(400, renameDialog.implicitHeight)
|
||||
maximumSize: Qt.size(400, renameDialog.implicitHeight)
|
||||
implicitWidth: minimumSize.width
|
||||
implicitHeight: minimumSize.height
|
||||
visible: false
|
||||
|
||||
onClosed: hide()
|
||||
|
||||
Reference in new issue
Block a user