From 141dd7c66ba3b480d27851b399ec50ac45ae8a57 Mon Sep 17 00:00:00 2001 From: bbedward Date: Wed, 13 Aug 2025 14:06:12 -0400 Subject: [PATCH] ensure loader patterns everywhere --- Modals/ClipboardHistoryModal.qml | 4 +- Modals/NotificationModal.qml | 40 +++----- Modals/SettingsModal.qml | 5 +- Modals/SpotlightModal.qml | 4 +- Modules/ControlCenter/NetworkTab.qml | 10 +- Modules/TopBar/TopBar.qml | 121 +++++++++++++++++------- Services/NetworkService.qml | 9 +- shell.qml | 134 ++++++++++++++++++++------- 8 files changed, 224 insertions(+), 103 deletions(-) diff --git a/Modals/ClipboardHistoryModal.qml b/Modals/ClipboardHistoryModal.qml index 3b4890a8..e7f41785 100644 --- a/Modals/ClipboardHistoryModal.qml +++ b/Modals/ClipboardHistoryModal.qml @@ -312,7 +312,7 @@ DankModal { target: "clipboard" } - content: Component { + property Component clipboardContent: Component { Column { anchors.fill: parent anchors.margins: Theme.spacingL @@ -637,4 +637,6 @@ DankModal { } } } + + content: clipboardContent } diff --git a/Modals/NotificationModal.qml b/Modals/NotificationModal.qml index 48dd3e0f..95cdd0cc 100644 --- a/Modals/NotificationModal.qml +++ b/Modals/NotificationModal.qml @@ -9,8 +9,14 @@ import qs.Modules.Notifications.Center import qs.Services import qs.Widgets -Item { - id: root +DankModal { + id: notificationModal + + width: 500 + height: 700 + visible: notificationModalOpen + keyboardFocus: "ondemand" + onBackgroundClicked: hide() NotificationKeyboardController { id: modalKeyboardController @@ -19,11 +25,6 @@ Item { onClose: function() { notificationModal.hide() } } - property alias notificationModal: notificationModal - - DankModal { - id: notificationModal - property bool notificationModalOpen: false property var notificationListRef: null @@ -51,26 +52,6 @@ Item { show() } - - - visible: notificationModalOpen - width: 500 - height: 700 - keyboardFocus: "ondemand" - backgroundColor: Theme.popupBackground() - cornerRadius: Theme.cornerRadius - borderColor: Theme.outlineMedium - borderWidth: 1 - enableShadow: true - - onVisibleChanged: { - if (visible && !notificationModalOpen) - show() - } - - onBackgroundClicked: { - notificationModalOpen = false - } IpcHandler { function open() { @@ -91,7 +72,7 @@ Item { target: "notifications" } - content: Component { + property Component notificationContent: Component { FocusScope { id: notificationKeyHandler @@ -171,5 +152,6 @@ Item { } } -} + + content: notificationContent } \ No newline at end of file diff --git a/Modals/SettingsModal.qml b/Modals/SettingsModal.qml index db433292..b23a51b9 100644 --- a/Modals/SettingsModal.qml +++ b/Modals/SettingsModal.qml @@ -1,5 +1,6 @@ pragma ComponentBehavior +import Quickshell import Quickshell.Io import QtQuick import QtQuick.Controls @@ -33,7 +34,7 @@ DankModal { keyboardFocus: "ondemand" onBackgroundClicked: hide() - content: Component { + property Component settingsContent: Component { Item { anchors.fill: parent focus: true @@ -181,6 +182,8 @@ DankModal { } } + content: settingsContent + IpcHandler { function open() { settingsModal.show() diff --git a/Modals/SpotlightModal.qml b/Modals/SpotlightModal.qml index 20ba6544..92103398 100644 --- a/Modals/SpotlightModal.qml +++ b/Modals/SpotlightModal.qml @@ -89,7 +89,7 @@ DankModal { target: "spotlight" } - content: Component { + property Component spotlightContent: Component { Item { id: spotlightKeyHandler @@ -846,4 +846,6 @@ DankModal { } } } + + content: spotlightContent } diff --git a/Modules/ControlCenter/NetworkTab.qml b/Modules/ControlCenter/NetworkTab.qml index 7d7929b7..9be65c4c 100644 --- a/Modules/ControlCenter/NetworkTab.qml +++ b/Modules/ControlCenter/NetworkTab.qml @@ -11,8 +11,14 @@ import qs.Modules.ControlCenter.Network Item { id: networkTab - property var wifiPasswordModalRef: wifiPasswordModal - property var networkInfoModalRef: networkInfoModal + property var wifiPasswordModalRef: { + wifiPasswordModalLoader.active = true + return wifiPasswordModalLoader.item + } + property var networkInfoModalRef: { + networkInfoModalLoader.active = true + return networkInfoModalLoader.item + } property var sortedWifiNetworks: { if (!NetworkService.wifiAvailable || !NetworkService.wifiEnabled) { diff --git a/Modules/TopBar/TopBar.qml b/Modules/TopBar/TopBar.qml index 9f951449..4b3f90fd 100644 --- a/Modules/TopBar/TopBar.qml +++ b/Modules/TopBar/TopBar.qml @@ -589,7 +589,7 @@ PanelWindow { id: launcherButtonComponent LauncherButton { - isActive: appDrawerPopout ? appDrawerPopout.isVisible : false + isActive: appDrawerLoader.item ? appDrawerLoader.item.isVisible : false section: { if (parent && parent.parent) { if (parent.parent === leftSection) @@ -601,11 +601,12 @@ PanelWindow { } return "left" } - popupTarget: appDrawerPopout + popupTarget: appDrawerLoader.item parentScreen: root.screen onClicked: { - if (appDrawerPopout) - appDrawerPopout.toggle() + appDrawerLoader.active = true + if (appDrawerLoader.item) + appDrawerLoader.item.toggle() } } } @@ -641,10 +642,16 @@ PanelWindow { return "center" return "center" } - popupTarget: centcomPopout + popupTarget: { + centcomPopoutLoader.active = true + return centcomPopoutLoader.item + } parentScreen: root.screen onClockClicked: { - centcomPopout.calendarVisible = !centcomPopout.calendarVisible + centcomPopoutLoader.active = true + if (centcomPopoutLoader.item) { + centcomPopoutLoader.item.calendarVisible = !centcomPopoutLoader.item.calendarVisible + } } } } @@ -663,10 +670,16 @@ PanelWindow { return "center" return "center" } - popupTarget: centcomPopout + popupTarget: { + centcomPopoutLoader.active = true + return centcomPopoutLoader.item + } parentScreen: root.screen onClicked: { - centcomPopout.calendarVisible = !centcomPopout.calendarVisible + centcomPopoutLoader.active = true + if (centcomPopoutLoader.item) { + centcomPopoutLoader.item.calendarVisible = !centcomPopoutLoader.item.calendarVisible + } } } } @@ -684,10 +697,16 @@ PanelWindow { return "center" return "center" } - popupTarget: centcomPopout + popupTarget: { + centcomPopoutLoader.active = true + return centcomPopoutLoader.item + } parentScreen: root.screen onClicked: { - centcomPopout.calendarVisible = !centcomPopout.calendarVisible + centcomPopoutLoader.active = true + if (centcomPopoutLoader.item) { + centcomPopoutLoader.item.calendarVisible = !centcomPopoutLoader.item.calendarVisible + } } } } @@ -731,10 +750,15 @@ PanelWindow { return "center" return "right" } - popupTarget: processListPopout + popupTarget: { + processListPopoutLoader.active = true + return processListPopoutLoader.item + } parentScreen: root.screen toggleProcessList: () => { - return processListPopout.toggle() + processListPopoutLoader.active = true + if (processListPopoutLoader.item) + return processListPopoutLoader.item.toggle() } } } @@ -752,10 +776,15 @@ PanelWindow { return "center" return "right" } - popupTarget: processListPopout + popupTarget: { + processListPopoutLoader.active = true + return processListPopoutLoader.item + } parentScreen: root.screen toggleProcessList: () => { - return processListPopout.toggle() + processListPopoutLoader.active = true + if (processListPopoutLoader.item) + return processListPopoutLoader.item.toggle() } } } @@ -773,10 +802,15 @@ PanelWindow { return "center" return "right" } - popupTarget: processListPopout + popupTarget: { + processListPopoutLoader.active = true + return processListPopoutLoader.item + } parentScreen: root.screen toggleProcessList: () => { - return processListPopout.toggle() + processListPopoutLoader.active = true + if (processListPopoutLoader.item) + return processListPopoutLoader.item.toggle() } } } @@ -794,11 +828,16 @@ PanelWindow { return "center" return "right" } - popupTarget: processListPopout + popupTarget: { + processListPopoutLoader.active = true + return processListPopoutLoader.item + } parentScreen: root.screen widgetData: parent.widgetData toggleProcessList: () => { - return processListPopout.toggle() + processListPopoutLoader.active = true + if (processListPopoutLoader.item) + return processListPopoutLoader.item.toggle() } } } @@ -808,7 +847,7 @@ PanelWindow { NotificationCenterButton { hasUnread: root.notificationCount > 0 - isActive: notificationCenter.notificationHistoryVisible + isActive: notificationCenterLoader.item ? notificationCenterLoader.item.notificationHistoryVisible : false section: { if (parent && parent.parent === leftSection) return "left" @@ -818,11 +857,17 @@ PanelWindow { return "center" return "right" } - popupTarget: notificationCenter + popupTarget: { + notificationCenterLoader.active = true + return notificationCenterLoader.item + } parentScreen: root.screen onClicked: { - notificationCenter.notificationHistoryVisible - = !notificationCenter.notificationHistoryVisible + notificationCenterLoader.active = true + if (notificationCenterLoader.item) { + notificationCenterLoader.item.notificationHistoryVisible + = !notificationCenterLoader.item.notificationHistoryVisible + } } } } @@ -831,7 +876,7 @@ PanelWindow { id: batteryComponent Battery { - batteryPopupVisible: batteryPopout.batteryPopupVisible + batteryPopupVisible: batteryPopoutLoader.item ? batteryPopoutLoader.item.batteryPopupVisible : false section: { if (parent && parent.parent === leftSection) return "left" @@ -841,10 +886,16 @@ PanelWindow { return "center" return "right" } - popupTarget: batteryPopout + popupTarget: { + batteryPopoutLoader.active = true + return batteryPopoutLoader.item + } parentScreen: root.screen onToggleBatteryPopup: { - batteryPopout.batteryPopupVisible = !batteryPopout.batteryPopupVisible + batteryPopoutLoader.active = true + if (batteryPopoutLoader.item) { + batteryPopoutLoader.item.batteryPopupVisible = !batteryPopoutLoader.item.batteryPopupVisible + } } } } @@ -853,7 +904,7 @@ PanelWindow { id: controlCenterButtonComponent ControlCenterButton { - isActive: controlCenterPopout.controlCenterVisible + isActive: controlCenterLoader.item ? controlCenterLoader.item.controlCenterVisible : false section: { if (parent && parent.parent === leftSection) return "left" @@ -863,14 +914,20 @@ PanelWindow { return "center" return "right" } - popupTarget: controlCenterPopout + popupTarget: { + controlCenterLoader.active = true + return controlCenterLoader.item + } parentScreen: root.screen onClicked: { - controlCenterPopout.triggerScreen = root.screen - controlCenterPopout.controlCenterVisible = !controlCenterPopout.controlCenterVisible - if (controlCenterPopout.controlCenterVisible) { - if (NetworkService.wifiEnabled) - NetworkService.scanWifi() + controlCenterLoader.active = true + if (controlCenterLoader.item) { + controlCenterLoader.item.triggerScreen = root.screen + controlCenterLoader.item.controlCenterVisible = !controlCenterLoader.item.controlCenterVisible + if (controlCenterLoader.item.controlCenterVisible) { + if (NetworkService.wifiEnabled) + NetworkService.scanWifi() + } } } } diff --git a/Services/NetworkService.qml b/Services/NetworkService.qml index 3fb11958..4907eb7a 100644 --- a/Services/NetworkService.qml +++ b/Services/NetworkService.qml @@ -745,15 +745,15 @@ Singleton { if (type === "wifi") { setRouteMetrics.command = ["bash", "-c", "nmcli -t -f NAME,TYPE connection show | grep 802-11-wireless | cut -d: -f1 | " + - "xargs -I {} nmcli connection modify {} ipv4.route-metric 50; " + + "xargs -I {} bash -c 'nmcli connection modify \"{}\" ipv4.route-metric 50 ipv6.route-metric 50'; " + "nmcli -t -f NAME,TYPE connection show | grep 802-3-ethernet | cut -d: -f1 | " + - "xargs -I {} nmcli connection modify {} ipv4.route-metric 100"] + "xargs -I {} bash -c 'nmcli connection modify \"{}\" ipv4.route-metric 100 ipv6.route-metric 100'"] } else if (type === "ethernet") { setRouteMetrics.command = ["bash", "-c", "nmcli -t -f NAME,TYPE connection show | grep 802-3-ethernet | cut -d: -f1 | " + - "xargs -I {} nmcli connection modify {} ipv4.route-metric 50; " + + "xargs -I {} bash -c 'nmcli connection modify \"{}\" ipv4.route-metric 50 ipv6.route-metric 50'; " + "nmcli -t -f NAME,TYPE connection show | grep 802-11-wireless | cut -d: -f1 | " + - "xargs -I {} nmcli connection modify {} ipv4.route-metric 100"] + "xargs -I {} bash -c 'nmcli connection modify \"{}\" ipv4.route-metric 100 ipv6.route-metric 100'"] } setRouteMetrics.running = true } @@ -763,6 +763,7 @@ Singleton { running: false onExited: (exitCode) => { + console.log("Set route metrics process exited with code:", exitCode) if (exitCode === 0) { restartConnections.running = true } diff --git a/shell.qml b/shell.qml index 3dd71276..c36fe392 100644 --- a/shell.qml +++ b/shell.qml @@ -42,25 +42,50 @@ ShellRoot { delegate: Dock { modelData: item - contextMenu: dockContextMenu - windowsMenu: dockWindowsMenu + contextMenu: dockContextMenuLoader.item ? dockContextMenuLoader.item : null + windowsMenu: dockWindowsMenuLoader.item ? dockWindowsMenuLoader.item : null + + Component.onCompleted: { + dockContextMenuLoader.active = true + dockWindowsMenuLoader.active = true + } } } - CentcomPopout { - id: centcomPopout + LazyLoader { + id: centcomPopoutLoader + active: false + + CentcomPopout { + id: centcomPopout + } } - DockContextMenu { - id: dockContextMenu + LazyLoader { + id: dockContextMenuLoader + active: false + + DockContextMenu { + id: dockContextMenu + } } - DockWindowsMenu { - id: dockWindowsMenu + LazyLoader { + id: dockWindowsMenuLoader + active: false + + DockWindowsMenu { + id: dockWindowsMenu + } } - NotificationCenterPopout { - id: notificationCenter + LazyLoader { + id: notificationCenterLoader + active: false + + NotificationCenterPopout { + id: notificationCenter + } } Variants { @@ -71,50 +96,93 @@ ShellRoot { } } - ControlCenterPopout { - id: controlCenterPopout + LazyLoader { + id: controlCenterLoader + active: false + + ControlCenterPopout { + id: controlCenterPopout - onPowerActionRequested: (action, title, message) => { - powerConfirmModal.powerConfirmAction = action - powerConfirmModal.powerConfirmTitle = title - powerConfirmModal.powerConfirmMessage = message - powerConfirmModal.powerConfirmVisible = true + onPowerActionRequested: (action, title, message) => { + powerConfirmModalLoader.active = true + if (powerConfirmModalLoader.item) { + powerConfirmModalLoader.item.powerConfirmAction = action + powerConfirmModalLoader.item.powerConfirmTitle = title + powerConfirmModalLoader.item.powerConfirmMessage = message + powerConfirmModalLoader.item.powerConfirmVisible = true + } } - onLockRequested: { - lock.activate() + onLockRequested: { + lock.activate() + } } } - WifiPasswordModal { - id: wifiPasswordModal + LazyLoader { + id: wifiPasswordModalLoader + active: false + + WifiPasswordModal { + id: wifiPasswordModal + } } - NetworkInfoModal { - id: networkInfoModal + LazyLoader { + id: networkInfoModalLoader + active: false + + NetworkInfoModal { + id: networkInfoModal + } } - BatteryPopout { - id: batteryPopout + LazyLoader { + id: batteryPopoutLoader + active: false + + BatteryPopout { + id: batteryPopout + } } - PowerMenu { - id: powerMenu + LazyLoader { + id: powerMenuLoader + active: false + + PowerMenu { + id: powerMenu + } } - PowerConfirmModal { - id: powerConfirmModal + LazyLoader { + id: powerConfirmModalLoader + active: false + + PowerConfirmModal { + id: powerConfirmModal + } } - ProcessListPopout { - id: processListPopout + LazyLoader { + id: processListPopoutLoader + active: false + + ProcessListPopout { + id: processListPopout + } } SettingsModal { id: settingsModal } - AppDrawerPopout { - id: appDrawerPopout + LazyLoader { + id: appDrawerLoader + active: false + + AppDrawerPopout { + id: appDrawerPopout + } } SpotlightModal {