mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-07 14:05:38 -05:00
Implement light & dark mode theme options
This commit is contained in:
@@ -8,6 +8,7 @@ Singleton {
|
||||
|
||||
property int themeIndex: 0
|
||||
property bool themeIsDynamic: false
|
||||
property bool isLightMode: false
|
||||
property var recentlyUsedApps: []
|
||||
|
||||
readonly property string configDir: Qt.resolvedUrl("file://" + Quickshell.env("HOME") + "/.config/DankMaterialDark")
|
||||
@@ -57,8 +58,9 @@ Singleton {
|
||||
var settings = JSON.parse(content)
|
||||
themeIndex = settings.themeIndex !== undefined ? settings.themeIndex : 0
|
||||
themeIsDynamic = settings.themeIsDynamic !== undefined ? settings.themeIsDynamic : false
|
||||
isLightMode = settings.isLightMode !== undefined ? settings.isLightMode : false
|
||||
recentlyUsedApps = settings.recentlyUsedApps || []
|
||||
console.log("Loaded settings - themeIndex:", themeIndex, "isDynamic:", themeIsDynamic, "recentApps:", recentlyUsedApps.length)
|
||||
console.log("Loaded settings - themeIndex:", themeIndex, "isDynamic:", themeIsDynamic, "lightMode:", isLightMode, "recentApps:", recentlyUsedApps.length)
|
||||
} else {
|
||||
console.log("Settings file is empty")
|
||||
}
|
||||
@@ -81,6 +83,7 @@ Singleton {
|
||||
var settings = {
|
||||
themeIndex: themeIndex,
|
||||
themeIsDynamic: themeIsDynamic,
|
||||
isLightMode: isLightMode,
|
||||
recentlyUsedApps: recentlyUsedApps
|
||||
}
|
||||
|
||||
@@ -88,7 +91,7 @@ Singleton {
|
||||
|
||||
writeProcess.command = ["sh", "-c", "echo '" + content + "' > '" + Quickshell.env("HOME") + "/.config/DankMaterialDark/settings.json'"]
|
||||
writeProcess.running = true
|
||||
console.log("Saving settings - themeIndex:", themeIndex, "isDynamic:", themeIsDynamic, "recentApps:", recentlyUsedApps.length)
|
||||
console.log("Saving settings - themeIndex:", themeIndex, "isDynamic:", themeIsDynamic, "lightMode:", isLightMode, "recentApps:", recentlyUsedApps.length)
|
||||
}
|
||||
|
||||
function applyStoredTheme() {
|
||||
@@ -112,6 +115,12 @@ Singleton {
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function setLightMode(lightMode) {
|
||||
console.log("Prefs setLightMode called - isLightMode:", lightMode)
|
||||
isLightMode = lightMode
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function addRecentApp(app) {
|
||||
var existingIndex = -1
|
||||
for (var i = 0; i < recentlyUsedApps.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user