diff --git a/quickshell/DMSShellIPC.qml b/quickshell/DMSShellIPC.qml index c0258a98..763b738c 100644 --- a/quickshell/DMSShellIPC.qml +++ b/quickshell/DMSShellIPC.qml @@ -161,37 +161,36 @@ Item { } IpcHandler { + function resolveTabIndex(tab: string): int { + switch ((tab || "").toLowerCase()) { + case "media": + return 1; + case "wallpaper": + return 2; + case "weather": + return SettingsData.weatherEnabled ? 3 : 0; + default: + return 0; + } + } + function open(tab: string): string { const bar = root.getPreferredBar("clockButtonRef"); if (!bar) return "DASH_OPEN_FAILED"; + const tabIndex = resolveTabIndex(tab); const dash = root.dankDashPopoutLoader.item; - const onSameScreen = dash && dash.shouldBeVisible && dash.triggerScreen?.name === bar.screen?.name; - - if (!onSameScreen) { - bar.triggerWallpaperBrowser(); + if (dash && dash.shouldBeVisible && dash.triggerScreen?.name === bar.screen?.name) { + dash.currentTabIndex = tabIndex; + if (dash.updateSurfacePosition) + dash.updateSurfacePosition(); + return "DASH_OPEN_SUCCESS"; } - if (!root.dankDashPopoutLoader.item) + if (!bar.triggerDashTab(tabIndex)) return "DASH_OPEN_FAILED"; - switch (tab.toLowerCase()) { - case "media": - root.dankDashPopoutLoader.item.currentTabIndex = 1; - break; - case "wallpaper": - root.dankDashPopoutLoader.item.currentTabIndex = 2; - break; - case "weather": - root.dankDashPopoutLoader.item.currentTabIndex = SettingsData.weatherEnabled ? 3 : 0; - break; - default: - root.dankDashPopoutLoader.item.currentTabIndex = 0; - break; - } - - root.dankDashPopoutLoader.item.dashVisible = true; return "DASH_OPEN_SUCCESS"; } @@ -211,23 +210,8 @@ Item { const bar = root.getPreferredBar("clockButtonRef"); if (bar) { - bar.triggerWallpaperBrowser(); - if (root.dankDashPopoutLoader.item) { - switch (tab.toLowerCase()) { - case "media": - root.dankDashPopoutLoader.item.currentTabIndex = 1; - break; - case "wallpaper": - root.dankDashPopoutLoader.item.currentTabIndex = 2; - break; - case "weather": - root.dankDashPopoutLoader.item.currentTabIndex = SettingsData.weatherEnabled ? 3 : 0; - break; - default: - root.dankDashPopoutLoader.item.currentTabIndex = 0; - break; - } - } + if (!bar.triggerDashTab(resolveTabIndex(tab))) + return "DASH_TOGGLE_FAILED"; return "DASH_TOGGLE_SUCCESS"; } return "DASH_TOGGLE_FAILED"; diff --git a/quickshell/Modules/ControlCenter/ControlCenterPopout.qml b/quickshell/Modules/ControlCenter/ControlCenterPopout.qml index a4d2f199..72536ca4 100644 --- a/quickshell/Modules/ControlCenter/ControlCenterPopout.qml +++ b/quickshell/Modules/ControlCenter/ControlCenterPopout.qml @@ -286,7 +286,11 @@ DankPopout { id: editControls width: parent.width visible: editMode - popoutContent: controlContent + popupScreen: root.screen + popoutX: root.alignedX + popoutY: root.alignedY + popoutWidth: root.alignedWidth + popoutHeight: root.alignedHeight availableWidgets: { if (!editMode) return []; diff --git a/quickshell/Modules/DankBar/DankBarWindow.qml b/quickshell/Modules/DankBar/DankBarWindow.qml index a7f5b621..b354b7f1 100644 --- a/quickshell/Modules/DankBar/DankBarWindow.qml +++ b/quickshell/Modules/DankBar/DankBarWindow.qml @@ -42,10 +42,10 @@ PanelWindow { } } - function triggerWallpaperBrowser() { + function triggerDashTab(tabIndex) { dankDashPopoutLoader.active = true; if (!dankDashPopoutLoader.item) { - return; + return false; } let section = "center"; @@ -81,7 +81,12 @@ PanelWindow { dankDashPopoutLoader.item.triggerScreen = barWindow.screen; } - PopoutManager.requestPopout(dankDashPopoutLoader.item, 2, (barConfig?.id ?? "default") + "-" + section + "-2"); + PopoutManager.requestPopout(dankDashPopoutLoader.item, tabIndex, (barConfig?.id ?? "default") + "-" + section + "-" + tabIndex); + return true; + } + + function triggerWallpaperBrowser() { + triggerDashTab(2); } readonly property var dBarLayer: { diff --git a/quickshell/Modules/Settings/DankBarTab.qml b/quickshell/Modules/Settings/DankBarTab.qml index 6c36fdfc..ff7b304b 100644 --- a/quickshell/Modules/Settings/DankBarTab.qml +++ b/quickshell/Modules/Settings/DankBarTab.qml @@ -1412,6 +1412,10 @@ Item { property: "value" value: selectedBarConfig?.widgetOutlineThickness ?? 1 restoreMode: Binding.RestoreBinding + } + } + } + Item { visible: dankBarTab.connectedFrameModeActive width: parent.width diff --git a/quickshell/Widgets/DankPopout.qml b/quickshell/Widgets/DankPopout.qml index 30281698..40d6ffa8 100644 --- a/quickshell/Widgets/DankPopout.qml +++ b/quickshell/Widgets/DankPopout.qml @@ -46,6 +46,7 @@ Item { readonly property var contentLoader: impl.item ? impl.item.contentLoader : _fallbackContentLoader readonly property var overlayLoader: impl.item ? impl.item.overlayLoader : _fallbackOverlayLoader + readonly property var backgroundWindow: impl.item ? impl.item.backgroundWindow : null Loader { id: _fallbackContentLoader diff --git a/quickshell/Widgets/DankPopoutConnected.qml b/quickshell/Widgets/DankPopoutConnected.qml index ebcbf273..75f02d8e 100644 --- a/quickshell/Widgets/DankPopoutConnected.qml +++ b/quickshell/Widgets/DankPopoutConnected.qml @@ -14,6 +14,7 @@ Item { property alias contentLoader: contentLoader property Component overlayContent: null property alias overlayLoader: overlayLoader + readonly property alias backgroundWindow: contentWindow property real popupWidth: 400 property real popupHeight: 300 property real triggerX: 0 @@ -222,8 +223,6 @@ Item { readonly property real contentAnimX: contentContainer.animX readonly property real contentAnimY: contentContainer.animY - property bool _fullSyncPending: false - // ─── ConnectedModeState sync ──────────────────────────────────────────── function _syncPopoutChromeState() { if (!root.frameOwnsConnectedChrome) { @@ -262,20 +261,8 @@ Item { ConnectedModeState.setPopoutBody(_chromeClaimId, root.alignedX, root.renderedAlignedY, root.alignedWidth, root.renderedAlignedHeight); } - function _flushFullSync() { - _fullSyncPending = false; - if (root && typeof root._syncPopoutChromeState === "function") - root._syncPopoutChromeState(); - } - function _queueFullSync() { - if (_fullSyncPending) - return; - _fullSyncPending = true; - Qt.callLater(() => { - if (root && typeof root._flushFullSync === "function") - root._flushFullSync(); - }); + _syncPopoutChromeState(); } onAlignedXChanged: _queueFullSync() @@ -349,15 +336,13 @@ Item { contentWindow.visible = true; - Qt.callLater(() => { - animationsEnabled = true; - shouldBeVisible = true; - if (shouldBeVisible && screen) { - contentWindow.visible = true; - PopoutManager.showPopout(popoutHandle); - opened(); - } - }); + animationsEnabled = true; + shouldBeVisible = true; + if (shouldBeVisible && screen) { + contentWindow.visible = true; + PopoutManager.showPopout(popoutHandle); + opened(); + } } function close() { diff --git a/quickshell/Widgets/DankPopoutStandalone.qml b/quickshell/Widgets/DankPopoutStandalone.qml index a179ba00..c0739299 100644 --- a/quickshell/Widgets/DankPopoutStandalone.qml +++ b/quickshell/Widgets/DankPopoutStandalone.qml @@ -13,6 +13,7 @@ Item { property alias contentLoader: contentLoader property Component overlayContent: null property alias overlayLoader: overlayLoader + readonly property alias backgroundWindow: backgroundWindow property real popupWidth: 400 property real popupHeight: 300 property real triggerX: 0 @@ -181,15 +182,13 @@ Item { _surfaceMarginLeft = alignedX - shadowBuffer; _surfaceW = alignedWidth + shadowBuffer * 2; } - Qt.callLater(() => { - if (shouldBeVisible && screen) { - if (useBackgroundWindow) - backgroundWindow.visible = true; - contentWindow.visible = true; - PopoutManager.showPopout(popoutHandle); - opened(); - } - }); + if (shouldBeVisible && screen) { + if (useBackgroundWindow) + backgroundWindow.visible = true; + contentWindow.visible = true; + PopoutManager.showPopout(popoutHandle); + opened(); + } } function close() { diff --git a/quickshell/Widgets/WindowBlur.qml b/quickshell/Widgets/WindowBlur.qml index 428f2d93..fdf8cdda 100644 --- a/quickshell/Widgets/WindowBlur.qml +++ b/quickshell/Widgets/WindowBlur.qml @@ -55,7 +55,7 @@ Item { } Connections { - target: root.targetWindow + target: root.targetWindow ?? null function onVisibleChanged() { if (root.targetWindow && root.targetWindow.visible) { root._region = null;