mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05:00
spotlight: optimize to keep loaded
This commit is contained in:
@@ -14,8 +14,31 @@ Singleton {
|
|||||||
property var activeModal: null
|
property var activeModal: null
|
||||||
property bool windowsVisible: false
|
property bool windowsVisible: false
|
||||||
property var targetScreen: null
|
property var targetScreen: null
|
||||||
|
property var persistentModal: null
|
||||||
|
|
||||||
readonly property bool hasActiveModal: activeModal !== null
|
readonly property bool hasActiveModal: activeModal !== null
|
||||||
|
readonly property bool hasPersistentModal: persistentModal !== null
|
||||||
|
readonly property bool isPersistentModalActive: hasActiveModal && activeModal === persistentModal
|
||||||
readonly property bool shouldShowModal: hasActiveModal
|
readonly property bool shouldShowModal: hasActiveModal
|
||||||
|
readonly property bool shouldKeepWindowsAlive: hasPersistentModal
|
||||||
|
|
||||||
|
onPersistentModalChanged: {
|
||||||
|
if (!persistentModal)
|
||||||
|
return;
|
||||||
|
cachedModal = persistentModal;
|
||||||
|
cachedModalWidth = Theme.px(persistentModal.modalWidth, dpr);
|
||||||
|
cachedModalHeight = Theme.px(persistentModal.modalHeight, dpr);
|
||||||
|
cachedModalX = calculateX(persistentModal);
|
||||||
|
cachedModalY = calculateY(persistentModal);
|
||||||
|
cachedAnimationDuration = persistentModal.animationDuration ?? Theme.shortDuration;
|
||||||
|
cachedEnterCurve = persistentModal.animationEnterCurve ?? Theme.expressiveCurves.expressiveFastSpatial;
|
||||||
|
cachedExitCurve = persistentModal.animationExitCurve ?? Theme.expressiveCurves.expressiveFastSpatial;
|
||||||
|
cachedScaleCollapsed = persistentModal.animationScaleCollapsed ?? 0.96;
|
||||||
|
if (persistentModal.directContent) {
|
||||||
|
persistentModal.directContent.parent = directContentWrapper;
|
||||||
|
persistentModal.directContent.anchors.fill = directContentWrapper;
|
||||||
|
}
|
||||||
|
}
|
||||||
readonly property var screen: backgroundWindow.screen
|
readonly property var screen: backgroundWindow.screen
|
||||||
readonly property real dpr: screen ? CompositorService.getScreenScale(screen) : 1
|
readonly property real dpr: screen ? CompositorService.getScreenScale(screen) : 1
|
||||||
readonly property real shadowBuffer: 5
|
readonly property real shadowBuffer: 5
|
||||||
@@ -161,7 +184,7 @@ Singleton {
|
|||||||
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: backgroundWindow
|
id: backgroundWindow
|
||||||
visible: root.windowsVisible
|
visible: root.windowsVisible || root.shouldKeepWindowsAlive
|
||||||
screen: root.targetScreen
|
screen: root.targetScreen
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
@@ -223,7 +246,7 @@ Singleton {
|
|||||||
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: contentWindow
|
id: contentWindow
|
||||||
visible: root.windowsVisible
|
visible: root.windowsVisible || root.shouldKeepWindowsAlive
|
||||||
screen: root.targetScreen
|
screen: root.targetScreen
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
|
|||||||
@@ -130,6 +130,10 @@ DankModal {
|
|||||||
target: "spotlight"
|
target: "spotlight"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
DankModalWindow.persistentModal = spotlightModal;
|
||||||
|
}
|
||||||
|
|
||||||
SpotlightContent {
|
SpotlightContent {
|
||||||
id: spotlightContentInstance
|
id: spotlightContentInstance
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user