mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-13 09:12:08 -04:00
fix(niri): restore lazy overview spotlight lifecycle to reduce idle VRAM (#1693)
This commit is contained in:
@@ -67,13 +67,17 @@ Scope {
|
|||||||
hideSpotlight();
|
hideSpotlight();
|
||||||
}
|
}
|
||||||
|
|
||||||
Variants {
|
Loader {
|
||||||
id: overlayVariants
|
id: niriOverlayLoader
|
||||||
model: Quickshell.screens
|
active: overlayActive || isClosing
|
||||||
|
asynchronous: false
|
||||||
|
sourceComponent: Variants {
|
||||||
|
id: overlayVariants
|
||||||
|
model: Quickshell.screens
|
||||||
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: overlayWindow
|
id: overlayWindow
|
||||||
required property var modelData
|
required property var modelData
|
||||||
|
|
||||||
readonly property real dpr: CompositorService.getScreenScale(screen)
|
readonly property real dpr: CompositorService.getScreenScale(screen)
|
||||||
readonly property bool isActiveScreen: screen.name === NiriService.currentOutput
|
readonly property bool isActiveScreen: screen.name === NiriService.currentOutput
|
||||||
@@ -97,9 +101,9 @@ Scope {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
screen: modelData
|
screen: modelData
|
||||||
visible: true
|
visible: overlayVisible
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
WlrLayershell.namespace: "dms:niri-overview-spotlight"
|
WlrLayershell.namespace: "dms:niri-overview-spotlight"
|
||||||
WlrLayershell.layer: WlrLayer.Overlay
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
@@ -196,10 +200,10 @@ Scope {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: spotlightContainer
|
id: spotlightContainer
|
||||||
x: Theme.snap((parent.width - width) / 2, overlayWindow.dpr)
|
x: Theme.snap((parent.width - width) / 2, overlayWindow.dpr)
|
||||||
y: Theme.snap((parent.height - height) / 2, overlayWindow.dpr)
|
y: Theme.snap((parent.height - height) / 2, overlayWindow.dpr)
|
||||||
|
|
||||||
readonly property int baseWidth: {
|
readonly property int baseWidth: {
|
||||||
switch (SettingsData.dankLauncherV2Size) {
|
switch (SettingsData.dankLauncherV2Size) {
|
||||||
@@ -235,9 +239,9 @@ Scope {
|
|||||||
visible: overlayWindow.shouldShowSpotlight || animatingOut
|
visible: overlayWindow.shouldShowSpotlight || animatingOut
|
||||||
enabled: overlayWindow.shouldShowSpotlight
|
enabled: overlayWindow.shouldShowSpotlight
|
||||||
|
|
||||||
layer.enabled: true
|
layer.enabled: visible
|
||||||
layer.smooth: false
|
layer.smooth: false
|
||||||
layer.textureSize: Qt.size(Math.round(width * overlayWindow.dpr), Math.round(height * overlayWindow.dpr))
|
layer.textureSize: layer.enabled ? Qt.size(Math.round(width * overlayWindow.dpr), Math.round(height * overlayWindow.dpr)) : Qt.size(0, 0)
|
||||||
|
|
||||||
Behavior on scale {
|
Behavior on scale {
|
||||||
id: scaleAnimation
|
id: scaleAnimation
|
||||||
@@ -269,40 +273,41 @@ Scope {
|
|||||||
border.width: 1
|
border.width: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
LauncherContent {
|
LauncherContent {
|
||||||
id: launcherContent
|
id: launcherContent
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 0
|
anchors.margins: 0
|
||||||
|
|
||||||
property var fakeParentModal: QtObject {
|
property var fakeParentModal: QtObject {
|
||||||
property bool spotlightOpen: spotlightContainer.visible
|
property bool spotlightOpen: spotlightContainer.visible
|
||||||
property bool isClosing: niriOverviewScope.isClosing
|
property bool isClosing: niriOverviewScope.isClosing
|
||||||
function hide() {
|
function hide() {
|
||||||
if (niriOverviewScope.searchActive) {
|
if (niriOverviewScope.searchActive) {
|
||||||
niriOverviewScope.hideSpotlight();
|
niriOverviewScope.hideSpotlight();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
NiriService.toggleOverview();
|
||||||
}
|
}
|
||||||
NiriService.toggleOverview();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: launcherContent.searchField
|
target: launcherContent.searchField
|
||||||
function onTextChanged() {
|
function onTextChanged() {
|
||||||
if (launcherContent.searchField.text.length > 0 || !niriOverviewScope.searchActive)
|
if (launcherContent.searchField.text.length > 0 || !niriOverviewScope.searchActive)
|
||||||
return;
|
return;
|
||||||
niriOverviewScope.hideSpotlight();
|
niriOverviewScope.hideSpotlight();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
parentModal = fakeParentModal;
|
parentModal = fakeParentModal;
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: launcherContent.controller
|
target: launcherContent.controller
|
||||||
function onItemExecuted() {
|
function onItemExecuted() {
|
||||||
niriOverviewScope.releaseKeyboard = true;
|
niriOverviewScope.releaseKeyboard = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user