mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05:00
theme: don't depend on dms for gsettings theme mode
This commit is contained in:
@@ -17,6 +17,7 @@ Singleton {
|
|||||||
property int systemColorScheme: 0
|
property int systemColorScheme: 0
|
||||||
|
|
||||||
property bool freedeskAvailable: false
|
property bool freedeskAvailable: false
|
||||||
|
property string colorSchemeCommand: ""
|
||||||
|
|
||||||
readonly property string socketPath: Quickshell.env("DMS_SOCKET")
|
readonly property string socketPath: Quickshell.env("DMS_SOCKET")
|
||||||
|
|
||||||
@@ -107,9 +108,15 @@ Singleton {
|
|||||||
if (typeof SettingsData !== "undefined" && SettingsData.syncModeWithPortal === false) {
|
if (typeof SettingsData !== "undefined" && SettingsData.syncModeWithPortal === false) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!settingsPortalAvailable || !freedeskAvailable) return
|
|
||||||
|
|
||||||
DMSService.sendRequest("freedesktop.settings.setColorScheme", { preferDark: !isLightMode }, response => {})
|
const targetScheme = isLightMode ? "default": "prefer-dark"
|
||||||
|
|
||||||
|
if (colorSchemeCommand === "gsettings") {
|
||||||
|
Quickshell.execDetached(["gsettings", "set", "org.gnome.desktop.interface", "color-scheme", targetScheme])
|
||||||
|
}
|
||||||
|
if (colorSchemeCommand === "dconf") {
|
||||||
|
Quickshell.execDetached(["dconf", "write", "/org/gnome/desktop/interface/color-scheme", `'${targetScheme}'`])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSystemIconTheme(themeName) {
|
function setSystemIconTheme(themeName) {
|
||||||
@@ -140,6 +147,7 @@ Singleton {
|
|||||||
} else {
|
} else {
|
||||||
console.log("PortalService: DMS_SOCKET not set")
|
console.log("PortalService: DMS_SOCKET not set")
|
||||||
}
|
}
|
||||||
|
colorSchemeDetector.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
@@ -240,6 +248,23 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: colorSchemeDetector
|
||||||
|
command: ["bash", "-c", "command -v gsettings || command -v dconf"]
|
||||||
|
running: false
|
||||||
|
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
const cmd = text.trim()
|
||||||
|
if (cmd.includes("gsettings")) {
|
||||||
|
root.colorSchemeCommand = "gsettings"
|
||||||
|
} else if (cmd.includes("dconf")) {
|
||||||
|
root.colorSchemeCommand = "dconf"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
target: "profile"
|
target: "profile"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user