diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b95855b..f9d762bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,5 +63,11 @@ if("shell" IN_LIST ENABLE_MODULES) foreach(dir assets components config modules services utils) install(DIRECTORY ${dir} DESTINATION "${INSTALL_QSCONFDIR}") endforeach() - install(FILES shell.qml LICENSE DESTINATION "${INSTALL_QSCONFDIR}") + + file(READ shell.qml SHELL_QML) + string(REPLACE "settings.watchFiles: true" "settings.watchFiles: false" SHELL_QML "${SHELL_QML}") + file(WRITE "${CMAKE_BINARY_DIR}/qml/shell.qml" "${SHELL_QML}") + install(FILES "${CMAKE_BINARY_DIR}/qml/shell.qml" DESTINATION "${INSTALL_QSCONFDIR}") + + install(FILES LICENSE DESTINATION "${INSTALL_QSCONFDIR}") endif() diff --git a/services/Colours.qml b/services/Colours.qml index 46911816..8a26e119 100644 --- a/services/Colours.qml +++ b/services/Colours.qml @@ -79,6 +79,21 @@ Singleton { Quickshell.execDetached(["caelestia", "scheme", "set", "--notify", "-m", mode]); } + function reloadHyprRules(): void { + const str = "keyword layerrule %1 %2, match:namespace caelestia-drawers"; + Hypr.extras.batchMessage([str.arg("blur").arg(transparency.enabled ? 1 : 0), str.arg("ignore_alpha").arg(transparency.base - 0.03)]); + } + + Component.onCompleted: debounceTimer.triggered() + + Connections { + function onConfigReloaded(): void { + root.reloadHyprRules(); + } + + target: Hypr + } + FileView { path: `${Paths.state}/scheme.json` watchChanges: true @@ -92,10 +107,20 @@ Singleton { source: Wallpapers.current } + Timer { + id: debounceTimer + + interval: 300 + onTriggered: root.reloadHyprRules() + } + component Transparency: QtObject { readonly property bool enabled: Appearance.transparency.enabled - readonly property real base: Appearance.transparency.base - (root.light ? 0.1 : 0) + readonly property real base: Math.max(0, Math.min(1, Appearance.transparency.base - (root.light ? 0.1 : 0))) readonly property real layers: Appearance.transparency.layers + + onEnabledChanged: debounceTimer.restart() + onBaseChanged: debounceTimer.restart() } component M3TPalette: QtObject { diff --git a/shell.qml b/shell.qml index 3ce77769..7ef1014d 100644 --- a/shell.qml +++ b/shell.qml @@ -10,6 +10,8 @@ import "modules/lock" import Quickshell ShellRoot { + settings.watchFiles: true + Background {} Drawers {} AreaPicker {}