mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
fix light mode ipc
This commit is contained in:
@@ -294,27 +294,4 @@ Singleton {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
target: "theme"
|
||||
|
||||
function toggle(): string {
|
||||
root.setLightMode(!root.isLightMode)
|
||||
return root.isLightMode ? "light" : "dark"
|
||||
}
|
||||
|
||||
function light(): string {
|
||||
root.setLightMode(true)
|
||||
return "light"
|
||||
}
|
||||
|
||||
function dark(): string {
|
||||
root.setLightMode(false)
|
||||
return "dark"
|
||||
}
|
||||
|
||||
function getMode(): string {
|
||||
return root.isLightMode ? "light" : "dark"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,12 +178,17 @@ Singleton {
|
||||
generateSystemThemesFromCurrentTheme()
|
||||
}
|
||||
|
||||
function toggleLightMode(savePrefs = true) {
|
||||
isLightMode = !isLightMode
|
||||
function setLightMode(light, savePrefs = true) {
|
||||
isLightMode = light
|
||||
if (savePrefs && typeof SessionData !== "undefined")
|
||||
SessionData.setLightMode(isLightMode)
|
||||
PortalService.setLightMode(isLightMode)
|
||||
generateSystemThemesFromCurrentTheme()
|
||||
}
|
||||
|
||||
function toggleLightMode(savePrefs = true) {
|
||||
setLightMode(!isLightMode, savePrefs)
|
||||
}
|
||||
|
||||
function forceGenerateSystemThemes() {
|
||||
if (!matugenAvailable) {
|
||||
@@ -706,4 +711,27 @@ Singleton {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
target: "theme"
|
||||
|
||||
function toggle(): string {
|
||||
root.toggleLightMode()
|
||||
return root.isLightMode ? "light" : "dark"
|
||||
}
|
||||
|
||||
function light(): string {
|
||||
root.setLightMode(true)
|
||||
return "light"
|
||||
}
|
||||
|
||||
function dark(): string {
|
||||
root.setLightMode(false)
|
||||
return "dark"
|
||||
}
|
||||
|
||||
function getMode(): string {
|
||||
return root.isLightMode ? "light" : "dark"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -253,10 +253,7 @@ Item {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
const newLightMode = !SessionData.isLightMode
|
||||
SessionData.setLightMode(newLightMode)
|
||||
Theme.isLightMode = newLightMode
|
||||
PortalService.setLightMode(newLightMode)
|
||||
Theme.toggleLightMode()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -677,10 +677,8 @@ Item {
|
||||
description: "Use light theme instead of dark theme"
|
||||
checked: SessionData.isLightMode
|
||||
onToggled: checked => {
|
||||
SessionData.setLightMode(checked)
|
||||
Theme.isLightMode = checked
|
||||
PortalService.setLightMode(checked)
|
||||
}
|
||||
Theme.setLightMode(checked)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user