From 52d5af11ba1943fc3d81d49cc28d312a32fbc7a9 Mon Sep 17 00:00:00 2001 From: bbedward Date: Sat, 14 Feb 2026 13:54:51 -0500 Subject: [PATCH] dankdash: fix triggering when clock widget isnt present on bar fixes #1601 --- quickshell/DMSShell.qml | 15 ++++-- quickshell/Services/PopoutService.qml | 73 ++++++++++++++++++++++++--- 2 files changed, 76 insertions(+), 12 deletions(-) diff --git a/quickshell/DMSShell.qml b/quickshell/DMSShell.qml index 7bc0f651..059e43ab 100644 --- a/quickshell/DMSShell.qml +++ b/quickshell/DMSShell.qml @@ -251,13 +251,20 @@ Item { active: false asynchronous: false + Component.onCompleted: { + PopoutService.dankDashPopoutLoader = dankDashPopoutLoader; + } + + onLoaded: { + if (item) { + PopoutService.dankDashPopout = item; + PopoutService._onDankDashPopoutLoaded(); + } + } + sourceComponent: Component { DankDashPopout { id: dankDashPopout - - Component.onCompleted: { - PopoutService.dankDashPopout = dankDashPopout; - } } } } diff --git a/quickshell/Services/PopoutService.qml b/quickshell/Services/PopoutService.qml index 10a92d7b..162f5545 100644 --- a/quickshell/Services/PopoutService.qml +++ b/quickshell/Services/PopoutService.qml @@ -13,6 +13,7 @@ Singleton { property var appDrawerPopout: null property var processListPopout: null property var dankDashPopout: null + property var dankDashPopoutLoader: null property var batteryPopout: null property var vpnPopout: null property var systemUpdatePopout: null @@ -119,31 +120,87 @@ Singleton { } } + property bool _dankDashWantsOpen: false + property bool _dankDashWantsToggle: false + property int _dankDashPendingTab: 0 + property real _dankDashPendingX: 0 + property real _dankDashPendingY: 0 + property real _dankDashPendingWidth: 0 + property string _dankDashPendingSection: "" + property var _dankDashPendingScreen: null + property bool _dankDashHasPosition: false + + function _storeDankDashPosition(x, y, width, section, screen, hasPos) { + _dankDashPendingX = x; + _dankDashPendingY = y; + _dankDashPendingWidth = width; + _dankDashPendingSection = section; + _dankDashPendingScreen = screen; + _dankDashHasPosition = hasPos; + } + function openDankDash(tabIndex, x, y, width, section, screen) { + _dankDashPendingTab = tabIndex || 0; if (dankDashPopout) { - if (arguments.length >= 6) { + if (arguments.length >= 6) setPosition(dankDashPopout, x, y, width, section, screen); - } - dankDashPopout.currentTabIndex = tabIndex || 0; + dankDashPopout.currentTabIndex = _dankDashPendingTab; dankDashPopout.dashVisible = true; + return; } + if (!dankDashPopoutLoader) + return; + _storeDankDashPosition(x, y, width, section, screen, arguments.length >= 6); + _dankDashWantsOpen = true; + _dankDashWantsToggle = false; + dankDashPopoutLoader.active = true; } function closeDankDash() { - if (dankDashPopout) { + if (dankDashPopout) dankDashPopout.dashVisible = false; - } } function toggleDankDash(tabIndex, x, y, width, section, screen) { + _dankDashPendingTab = tabIndex || 0; if (dankDashPopout) { - if (arguments.length >= 6) { + if (arguments.length >= 6) setPosition(dankDashPopout, x, y, width, section, screen); - } if (dankDashPopout.dashVisible) { dankDashPopout.dashVisible = false; } else { - dankDashPopout.currentTabIndex = tabIndex || 0; + dankDashPopout.currentTabIndex = _dankDashPendingTab; + dankDashPopout.dashVisible = true; + } + return; + } + if (!dankDashPopoutLoader) + return; + _storeDankDashPosition(x, y, width, section, screen, arguments.length >= 6); + _dankDashWantsToggle = true; + _dankDashWantsOpen = false; + dankDashPopoutLoader.active = true; + } + + function _onDankDashPopoutLoaded() { + if (!dankDashPopout) + return; + + if (_dankDashHasPosition) + setPosition(dankDashPopout, _dankDashPendingX, _dankDashPendingY, _dankDashPendingWidth, _dankDashPendingSection, _dankDashPendingScreen); + + if (_dankDashWantsOpen) { + _dankDashWantsOpen = false; + dankDashPopout.currentTabIndex = _dankDashPendingTab; + dankDashPopout.dashVisible = true; + return; + } + if (_dankDashWantsToggle) { + _dankDashWantsToggle = false; + if (dankDashPopout.dashVisible) { + dankDashPopout.dashVisible = false; + } else { + dankDashPopout.currentTabIndex = _dankDashPendingTab; dankDashPopout.dashVisible = true; } }