1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-07 05:55:37 -05:00

bring back lazy loaders

This commit is contained in:
bbedward
2025-08-13 18:10:20 -04:00
parent 83c97eb245
commit cc6e465be1
4 changed files with 200 additions and 69 deletions

View File

@@ -145,13 +145,13 @@ Singleton {
id: matugenCollector id: matugenCollector
onStreamFinished: { onStreamFinished: {
if (!text) { if (!matugenCollector.text) {
ToastService.wallpaperErrorStatus = "error" ToastService.wallpaperErrorStatus = "error"
ToastService.showError("Wallpaper Processing Failed: Empty JSON extracted from matugen output.") ToastService.showError("Wallpaper Processing Failed: Empty JSON extracted from matugen output.")
return return
} }
try { try {
root.matugenColors = JSON.parse(text) root.matugenColors = JSON.parse(matugenCollector.text)
root.colorsUpdated() root.colorsUpdated()
generateAppConfigs() generateAppConfigs()
ToastService.clearWallpaperError() ToastService.clearWallpaperError()

View File

@@ -11,8 +11,14 @@ import qs.Modules.ControlCenter.Network
Item { Item {
id: networkTab id: networkTab
property var wifiPasswordModalRef: wifiPasswordModal property var wifiPasswordModalRef: {
property var networkInfoModalRef: networkInfoModal wifiPasswordModalLoader.active = true
return wifiPasswordModalLoader.item
}
property var networkInfoModalRef: {
networkInfoModalLoader.active = true
return networkInfoModalLoader.item
}
property var sortedWifiNetworks: { property var sortedWifiNetworks: {
if (!NetworkService.wifiAvailable || !NetworkService.wifiEnabled) { if (!NetworkService.wifiAvailable || !NetworkService.wifiEnabled) {

View File

@@ -589,7 +589,7 @@ PanelWindow {
id: launcherButtonComponent id: launcherButtonComponent
LauncherButton { LauncherButton {
isActive: appDrawerPopout ? appDrawerPopout.isVisible : false isActive: appDrawerLoader.item ? appDrawerLoader.item.isVisible : false
section: { section: {
if (parent && parent.parent) { if (parent && parent.parent) {
if (parent.parent === leftSection) if (parent.parent === leftSection)
@@ -601,11 +601,12 @@ PanelWindow {
} }
return "left" return "left"
} }
popupTarget: appDrawerPopout popupTarget: appDrawerLoader.item
parentScreen: root.screen parentScreen: root.screen
onClicked: { onClicked: {
if (appDrawerPopout) appDrawerLoader.active = true
appDrawerPopout.toggle() if (appDrawerLoader.item)
appDrawerLoader.item.toggle()
} }
} }
} }
@@ -641,10 +642,16 @@ if (appDrawerPopout)
return "center" return "center"
return "center" return "center"
} }
popupTarget: centcomPopout popupTarget: {
centcomPopoutLoader.active = true
return centcomPopoutLoader.item
}
parentScreen: root.screen parentScreen: root.screen
onClockClicked: { onClockClicked: {
centcomPopout.calendarVisible = !centcomPopout.calendarVisible centcomPopoutLoader.active = true
if (centcomPopoutLoader.item) {
centcomPopoutLoader.item.calendarVisible = !centcomPopoutLoader.item.calendarVisible
}
} }
} }
} }
@@ -663,10 +670,16 @@ centcomPopout.calendarVisible = !centcomPopout.calendarVisible
return "center" return "center"
return "center" return "center"
} }
popupTarget: centcomPopout popupTarget: {
centcomPopoutLoader.active = true
return centcomPopoutLoader.item
}
parentScreen: root.screen parentScreen: root.screen
onClicked: { onClicked: {
centcomPopout.calendarVisible = !centcomPopout.calendarVisible centcomPopoutLoader.active = true
if (centcomPopoutLoader.item) {
centcomPopoutLoader.item.calendarVisible = !centcomPopoutLoader.item.calendarVisible
}
} }
} }
} }
@@ -684,10 +697,16 @@ centcomPopout.calendarVisible = !centcomPopout.calendarVisible
return "center" return "center"
return "center" return "center"
} }
popupTarget: centcomPopout popupTarget: {
centcomPopoutLoader.active = true
return centcomPopoutLoader.item
}
parentScreen: root.screen parentScreen: root.screen
onClicked: { onClicked: {
centcomPopout.calendarVisible = !centcomPopout.calendarVisible centcomPopoutLoader.active = true
if (centcomPopoutLoader.item) {
centcomPopoutLoader.item.calendarVisible = !centcomPopoutLoader.item.calendarVisible
}
} }
} }
} }
@@ -731,10 +750,15 @@ centcomPopout.calendarVisible = !centcomPopout.calendarVisible
return "center" return "center"
return "right" return "right"
} }
popupTarget: processListPopout popupTarget: {
processListPopoutLoader.active = true
return processListPopoutLoader.item
}
parentScreen: root.screen parentScreen: root.screen
toggleProcessList: () => { toggleProcessList: () => {
return processListPopout.toggle() processListPopoutLoader.active = true
if (processListPopoutLoader.item)
return processListPopoutLoader.item.toggle()
} }
} }
} }
@@ -752,10 +776,15 @@ return processListPopout.toggle()
return "center" return "center"
return "right" return "right"
} }
popupTarget: processListPopout popupTarget: {
processListPopoutLoader.active = true
return processListPopoutLoader.item
}
parentScreen: root.screen parentScreen: root.screen
toggleProcessList: () => { toggleProcessList: () => {
return processListPopout.toggle() processListPopoutLoader.active = true
if (processListPopoutLoader.item)
return processListPopoutLoader.item.toggle()
} }
} }
} }
@@ -773,10 +802,15 @@ return processListPopout.toggle()
return "center" return "center"
return "right" return "right"
} }
popupTarget: processListPopout popupTarget: {
processListPopoutLoader.active = true
return processListPopoutLoader.item
}
parentScreen: root.screen parentScreen: root.screen
toggleProcessList: () => { toggleProcessList: () => {
return processListPopout.toggle() processListPopoutLoader.active = true
if (processListPopoutLoader.item)
return processListPopoutLoader.item.toggle()
} }
} }
} }
@@ -794,11 +828,16 @@ return processListPopout.toggle()
return "center" return "center"
return "right" return "right"
} }
popupTarget: processListPopout popupTarget: {
processListPopoutLoader.active = true
return processListPopoutLoader.item
}
parentScreen: root.screen parentScreen: root.screen
widgetData: parent.widgetData widgetData: parent.widgetData
toggleProcessList: () => { toggleProcessList: () => {
return processListPopout.toggle() processListPopoutLoader.active = true
if (processListPopoutLoader.item)
return processListPopoutLoader.item.toggle()
} }
} }
} }
@@ -808,7 +847,7 @@ return processListPopout.toggle()
NotificationCenterButton { NotificationCenterButton {
hasUnread: root.notificationCount > 0 hasUnread: root.notificationCount > 0
isActive: notificationCenter.notificationHistoryVisible isActive: notificationCenterLoader.item ? notificationCenterLoader.item.notificationHistoryVisible : false
section: { section: {
if (parent && parent.parent === leftSection) if (parent && parent.parent === leftSection)
return "left" return "left"
@@ -818,11 +857,17 @@ return processListPopout.toggle()
return "center" return "center"
return "right" return "right"
} }
popupTarget: notificationCenter popupTarget: {
notificationCenterLoader.active = true
return notificationCenterLoader.item
}
parentScreen: root.screen parentScreen: root.screen
onClicked: { onClicked: {
notificationCenter.notificationHistoryVisible notificationCenterLoader.active = true
= !notificationCenter.notificationHistoryVisible if (notificationCenterLoader.item) {
notificationCenterLoader.item.notificationHistoryVisible
= !notificationCenterLoader.item.notificationHistoryVisible
}
} }
} }
} }
@@ -831,7 +876,7 @@ notificationCenter.notificationHistoryVisible
id: batteryComponent id: batteryComponent
Battery { Battery {
batteryPopupVisible: batteryPopout.batteryPopupVisible batteryPopupVisible: batteryPopoutLoader.item ? batteryPopoutLoader.item.batteryPopupVisible : false
section: { section: {
if (parent && parent.parent === leftSection) if (parent && parent.parent === leftSection)
return "left" return "left"
@@ -841,10 +886,16 @@ notificationCenter.notificationHistoryVisible
return "center" return "center"
return "right" return "right"
} }
popupTarget: batteryPopout popupTarget: {
batteryPopoutLoader.active = true
return batteryPopoutLoader.item
}
parentScreen: root.screen parentScreen: root.screen
onToggleBatteryPopup: { onToggleBatteryPopup: {
batteryPopout.batteryPopupVisible = !batteryPopout.batteryPopupVisible batteryPopoutLoader.active = true
if (batteryPopoutLoader.item) {
batteryPopoutLoader.item.batteryPopupVisible = !batteryPopoutLoader.item.batteryPopupVisible
}
} }
} }
} }
@@ -853,7 +904,7 @@ batteryPopout.batteryPopupVisible = !batteryPopout.batteryPopupVisible
id: controlCenterButtonComponent id: controlCenterButtonComponent
ControlCenterButton { ControlCenterButton {
isActive: controlCenterPopout.controlCenterVisible isActive: controlCenterLoader.item ? controlCenterLoader.item.controlCenterVisible : false
section: { section: {
if (parent && parent.parent === leftSection) if (parent && parent.parent === leftSection)
return "left" return "left"
@@ -863,18 +914,24 @@ batteryPopout.batteryPopupVisible = !batteryPopout.batteryPopupVisible
return "center" return "center"
return "right" return "right"
} }
popupTarget: controlCenterPopout popupTarget: {
controlCenterLoader.active = true
return controlCenterLoader.item
}
parentScreen: root.screen parentScreen: root.screen
onClicked: { onClicked: {
controlCenterPopout.triggerScreen = root.screen controlCenterLoader.active = true
controlCenterPopout.controlCenterVisible = !controlCenterPopout.controlCenterVisible if (controlCenterLoader.item) {
if (controlCenterPopout.controlCenterVisible) { controlCenterLoader.item.triggerScreen = root.screen
controlCenterLoader.item.controlCenterVisible = !controlCenterLoader.item.controlCenterVisible
if (controlCenterLoader.item.controlCenterVisible) {
if (NetworkService.wifiEnabled) if (NetworkService.wifiEnabled)
NetworkService.scanWifi() NetworkService.scanWifi()
} }
} }
} }
} }
}
Component { Component {
id: spacerComponent id: spacerComponent

View File

@@ -42,26 +42,51 @@ ShellRoot {
delegate: Dock { delegate: Dock {
modelData: item modelData: item
contextMenu: dockContextMenu contextMenu: dockContextMenuLoader.item ? dockContextMenuLoader.item : null
windowsMenu: dockWindowsMenu windowsMenu: dockWindowsMenuLoader.item ? dockWindowsMenuLoader.item : null
Component.onCompleted: {
dockContextMenuLoader.active = true
dockWindowsMenuLoader.active = true
} }
} }
}
LazyLoader {
id: centcomPopoutLoader
active: false
CentcomPopout { CentcomPopout {
id: centcomPopout id: centcomPopout
} }
}
LazyLoader {
id: dockContextMenuLoader
active: false
DockContextMenu { DockContextMenu {
id: dockContextMenu id: dockContextMenu
} }
}
LazyLoader {
id: dockWindowsMenuLoader
active: false
DockWindowsMenu { DockWindowsMenu {
id: dockWindowsMenu id: dockWindowsMenu
} }
}
LazyLoader {
id: notificationCenterLoader
active: false
NotificationCenterPopout { NotificationCenterPopout {
id: notificationCenter id: notificationCenter
} }
}
Variants { Variants {
model: Quickshell.screens model: Quickshell.screens
@@ -71,51 +96,94 @@ ShellRoot {
} }
} }
LazyLoader {
id: controlCenterLoader
active: false
ControlCenterPopout { ControlCenterPopout {
id: controlCenterPopout id: controlCenterPopout
onPowerActionRequested: (action, title, message) => { onPowerActionRequested: (action, title, message) => {
powerConfirmModal.powerConfirmAction = action powerConfirmModalLoader.active = true
powerConfirmModal.powerConfirmTitle = title if (powerConfirmModalLoader.item) {
powerConfirmModal.powerConfirmMessage = message powerConfirmModalLoader.item.powerConfirmAction = action
powerConfirmModal.powerConfirmVisible = true powerConfirmModalLoader.item.powerConfirmTitle = title
powerConfirmModalLoader.item.powerConfirmMessage = message
powerConfirmModalLoader.item.powerConfirmVisible = true
}
} }
onLockRequested: { onLockRequested: {
lock.activate() lock.activate()
} }
} }
}
LazyLoader {
id: wifiPasswordModalLoader
active: false
WifiPasswordModal { WifiPasswordModal {
id: wifiPasswordModal id: wifiPasswordModal
} }
}
LazyLoader {
id: networkInfoModalLoader
active: false
NetworkInfoModal { NetworkInfoModal {
id: networkInfoModal id: networkInfoModal
} }
}
LazyLoader {
id: batteryPopoutLoader
active: false
BatteryPopout { BatteryPopout {
id: batteryPopout id: batteryPopout
} }
}
LazyLoader {
id: powerMenuLoader
active: false
PowerMenu { PowerMenu {
id: powerMenu id: powerMenu
} }
}
LazyLoader {
id: powerConfirmModalLoader
active: false
PowerConfirmModal { PowerConfirmModal {
id: powerConfirmModal id: powerConfirmModal
} }
}
LazyLoader {
id: processListPopoutLoader
active: false
ProcessListPopout { ProcessListPopout {
id: processListPopout id: processListPopout
} }
}
SettingsModal { SettingsModal {
id: settingsModal id: settingsModal
} }
LazyLoader {
id: appDrawerLoader
active: false
AppDrawerPopout { AppDrawerPopout {
id: appDrawerPopout id: appDrawerPopout
} }
}
SpotlightModal { SpotlightModal {
id: spotlightModal id: spotlightModal