DarkModeToggle: new bar widget

This commit is contained in:
LemmyCook 2025-09-02 10:34:05 -04:00
parent b908dc0ed2
commit 508c1407be
7 changed files with 89 additions and 36 deletions

View file

@ -10,16 +10,30 @@ import qs.Services
Singleton {
id: root
Component.onCompleted: {
Logger.log("ColorScheme", "Service started")
loadColorSchemes()
}
property var schemes: []
property bool scanning: false
property string schemesDirectory: Quickshell.shellDir + "/Assets/ColorScheme"
property string colorsJsonFilePath: Settings.configDir + "colors.json"
Connections {
target: Settings.data.colorSchemes
function onDarkModeChanged() {
Logger.log("ColorScheme", "Detected dark mode change")
if (!Settings.data.colorSchemes.useWallpaperColors && Settings.data.colorSchemes.predefinedScheme) {
// Re-apply current scheme to pick the right variant
applyScheme(Settings.data.colorSchemes.predefinedScheme)
}
}
}
// --------------------------------
function init() {
// does nothing but ensure the singleton is created
// do not remove
Logger.log("ColorScheme", "Service started")
loadColorSchemes()
}
function loadColorSchemes() {
Logger.log("ColorScheme", "Load ColorScheme")
scanning = true