diff --git a/quickshell/Modals/Changelog/ChangelogModal.qml b/quickshell/Modals/Changelog/ChangelogModal.qml index fe9c41ce2..2c30f1e93 100644 --- a/quickshell/Modals/Changelog/ChangelogModal.qml +++ b/quickshell/Modals/Changelog/ChangelogModal.qml @@ -24,6 +24,8 @@ FloatingWindow { color: Theme.surfaceContainer visible: false + onClosed: visible = false + FocusScope { id: contentFocusScope anchors.fill: parent diff --git a/quickshell/Modals/FileBrowser/FileBrowserModal.qml b/quickshell/Modals/FileBrowser/FileBrowserModal.qml index df0c5552f..449a8a564 100644 --- a/quickshell/Modals/FileBrowser/FileBrowserModal.qml +++ b/quickshell/Modals/FileBrowser/FileBrowserModal.qml @@ -41,6 +41,8 @@ FloatingWindow { color: Theme.surfaceContainer visible: false + onClosed: close() + onVisibleChanged: { if (visible) { if (parentModal && "shouldHaveFocus" in parentModal) { diff --git a/quickshell/Modals/Greeter/GreeterModal.qml b/quickshell/Modals/Greeter/GreeterModal.qml index 2c8d0714d..4a2222aec 100644 --- a/quickshell/Modals/Greeter/GreeterModal.qml +++ b/quickshell/Modals/Greeter/GreeterModal.qml @@ -93,6 +93,8 @@ FloatingWindow { color: Theme.surfaceContainer visible: false + onClosed: visible = false + Process { id: cheatsheetProcess running: false diff --git a/quickshell/Modals/PolkitAuthModal.qml b/quickshell/Modals/PolkitAuthModal.qml index 6e93335dd..bd9ab52d9 100644 --- a/quickshell/Modals/PolkitAuthModal.qml +++ b/quickshell/Modals/PolkitAuthModal.qml @@ -32,6 +32,8 @@ FloatingWindow { color: Theme.surfaceContainer visible: false + onClosed: hide() + onVisibleChanged: { if (visible) { Qt.callLater(focusContent); diff --git a/quickshell/Modals/Settings/SettingsModal.qml b/quickshell/Modals/Settings/SettingsModal.qml index df990cfdc..0d3bc7ed5 100644 --- a/quickshell/Modals/Settings/SettingsModal.qml +++ b/quickshell/Modals/Settings/SettingsModal.qml @@ -92,6 +92,8 @@ FloatingWindow { color: Theme.surfaceContainer visible: false + onClosed: hide() + onIsCompactModeChanged: { enableAnimations = false; if (!isCompactMode) { diff --git a/quickshell/Modals/WindowRuleModal.qml b/quickshell/Modals/WindowRuleModal.qml index af1dd0046..b8c4769e8 100644 --- a/quickshell/Modals/WindowRuleModal.qml +++ b/quickshell/Modals/WindowRuleModal.qml @@ -32,6 +32,8 @@ FloatingWindow { color: Theme.surfaceContainer visible: false + onClosed: hide() + function resetForm() { nameInput.text = ""; appIdInput.text = ""; diff --git a/quickshell/Modals/WorkspaceRenameModal.qml b/quickshell/Modals/WorkspaceRenameModal.qml index 43cbd4da2..cb530aba2 100644 --- a/quickshell/Modals/WorkspaceRenameModal.qml +++ b/quickshell/Modals/WorkspaceRenameModal.qml @@ -18,6 +18,8 @@ FloatingWindow { color: Theme.surfaceContainer visible: false + onClosed: hide() + function show(name) { nameInput.text = name; visible = true; diff --git a/quickshell/Modules/DankBar/CenterSection.qml b/quickshell/Modules/DankBar/CenterSection.qml index 928f2cd83..e9ed2ede2 100644 --- a/quickshell/Modules/DankBar/CenterSection.qml +++ b/quickshell/Modules/DankBar/CenterSection.qml @@ -48,7 +48,7 @@ Item { for (var i = 0; i < centerRepeater.count; i++) { const loader = centerRepeater.itemAt(i); - if (loader && loader.active && loader.item) { + if (loader && loader.active && loader.item && loader.item.visible) { centerWidgets.push(loader.item); totalWidgets++; totalSize += isVertical ? loader.item.height : loader.item.width; @@ -105,14 +105,14 @@ Item { if (!wrapper) continue; - if (isOddConfigured && i === configuredMiddlePos && wrapper.active && wrapper.item) + if (isOddConfigured && i === configuredMiddlePos && wrapper.active && wrapper.item && wrapper.item.visible) configuredMiddleWidget = wrapper.item; - if (!isOddConfigured && i === configuredLeftPos && wrapper.active && wrapper.item) + if (!isOddConfigured && i === configuredLeftPos && wrapper.active && wrapper.item && wrapper.item.visible) configuredLeftWidget = wrapper.item; - if (!isOddConfigured && i === configuredRightPos && wrapper.active && wrapper.item) + if (!isOddConfigured && i === configuredRightPos && wrapper.active && wrapper.item && wrapper.item.visible) configuredRightWidget = wrapper.item; - if (wrapper.active && wrapper.item) { + if (wrapper.active && wrapper.item && wrapper.item.visible) { centerWidgets.push(wrapper.item); totalWidgets++; totalSize += isVertical ? wrapper.item.height : wrapper.item.width; @@ -372,6 +372,7 @@ Item { onContentItemReady: contentItem => { contentItem.widthChanged.connect(() => layoutTimer.restart()); contentItem.heightChanged.connect(() => layoutTimer.restart()); + contentItem.visibleChanged.connect(() => layoutTimer.restart()); layoutTimer.restart(); } diff --git a/quickshell/Modules/DankBar/LeftSection.qml b/quickshell/Modules/DankBar/LeftSection.qml index 9f01094f7..ced23971c 100644 --- a/quickshell/Modules/DankBar/LeftSection.qml +++ b/quickshell/Modules/DankBar/LeftSection.qml @@ -45,6 +45,7 @@ Item { Item { readonly property real rowSpacing: parent.widgetSpacing property var itemData: modelData + visible: widgetLoader.active && widgetLoader.widgetEnabled width: widgetLoader.item ? widgetLoader.item.width : 0 height: widgetLoader.item ? widgetLoader.item.height : 0 WidgetHost { @@ -92,6 +93,7 @@ Item { width: parent.width readonly property real columnSpacing: parent.widgetSpacing property var itemData: modelData + visible: widgetLoader.active && widgetLoader.widgetEnabled height: widgetLoader.item ? widgetLoader.item.height : 0 WidgetHost { id: widgetLoader diff --git a/quickshell/Modules/DankBar/RightSection.qml b/quickshell/Modules/DankBar/RightSection.qml index e9f9a73d4..6d6d43342 100644 --- a/quickshell/Modules/DankBar/RightSection.qml +++ b/quickshell/Modules/DankBar/RightSection.qml @@ -47,6 +47,7 @@ Item { Item { readonly property real rowSpacing: parent.widgetSpacing property var itemData: modelData + visible: widgetLoader.active && widgetLoader.widgetEnabled width: widgetLoader.item ? widgetLoader.item.width : 0 height: widgetLoader.item ? widgetLoader.item.height : 0 WidgetHost { @@ -94,6 +95,7 @@ Item { width: parent.width readonly property real columnSpacing: parent.widgetSpacing property var itemData: modelData + visible: widgetLoader.active && widgetLoader.widgetEnabled height: widgetLoader.item ? widgetLoader.item.height : 0 WidgetHost { id: widgetLoader diff --git a/quickshell/Modules/DankBar/WidgetHost.qml b/quickshell/Modules/DankBar/WidgetHost.qml index 98497161a..d864c6795 100644 --- a/quickshell/Modules/DankBar/WidgetHost.qml +++ b/quickshell/Modules/DankBar/WidgetHost.qml @@ -26,6 +26,7 @@ Loader { property bool isTopBarEdge: false property bool isBottomBarEdge: false property string _registeredScreenName: "" + property var _registeredItem: null asynchronous: false @@ -227,15 +228,17 @@ Loader { return; _registeredScreenName = parentScreen.name; - BarWidgetService.registerWidget(widgetId, _registeredScreenName, item); + _registeredItem = item; + BarWidgetService.registerWidget(widgetId, _registeredScreenName, _registeredItem); } function unregisterWidget() { if (!widgetId || !_registeredScreenName) return; - BarWidgetService.unregisterWidget(widgetId, _registeredScreenName); + BarWidgetService.unregisterWidget(widgetId, _registeredScreenName, _registeredItem); _registeredScreenName = ""; + _registeredItem = null; } function getWidgetComponent(widgetId, components) { diff --git a/quickshell/Modules/Settings/DesktopWidgetBrowser.qml b/quickshell/Modules/Settings/DesktopWidgetBrowser.qml index 35b331295..7f0be93a0 100644 --- a/quickshell/Modules/Settings/DesktopWidgetBrowser.qml +++ b/quickshell/Modules/Settings/DesktopWidgetBrowser.qml @@ -110,6 +110,8 @@ FloatingWindow { color: Theme.surfaceContainer visible: false + onClosed: hide() + onVisibleChanged: { if (visible) { updateFilteredWidgets(); diff --git a/quickshell/Modules/Settings/PluginBrowser.qml b/quickshell/Modules/Settings/PluginBrowser.qml index 93ac3a065..e2c5e23f0 100644 --- a/quickshell/Modules/Settings/PluginBrowser.qml +++ b/quickshell/Modules/Settings/PluginBrowser.qml @@ -482,6 +482,8 @@ FloatingWindow { color: Theme.surfaceContainer visible: false + onClosed: hide() + onVisibleChanged: { if (visible) { pendingInstallHandled = false; diff --git a/quickshell/Modules/Settings/WidgetSelectionPopup.qml b/quickshell/Modules/Settings/WidgetSelectionPopup.qml index 6dfc3fdc3..cf9b9cc06 100644 --- a/quickshell/Modules/Settings/WidgetSelectionPopup.qml +++ b/quickshell/Modules/Settings/WidgetSelectionPopup.qml @@ -115,6 +115,8 @@ FloatingWindow { color: blurActive ? Theme.withAlpha(Theme.surfaceContainer, 0) : Theme.surfaceContainer visible: false + onClosed: hide() + onVisibleChanged: { if (visible) { Qt.callLater(() => { diff --git a/quickshell/Modules/Settings/Widgets/AppBrowserPopup.qml b/quickshell/Modules/Settings/Widgets/AppBrowserPopup.qml index 188a71b4b..bd4a73b52 100644 --- a/quickshell/Modules/Settings/Widgets/AppBrowserPopup.qml +++ b/quickshell/Modules/Settings/Widgets/AppBrowserPopup.qml @@ -26,6 +26,8 @@ FloatingWindow { color: "transparent" visible: false + onClosed: hide() + WindowBlur { targetWindow: root blurX: 0 diff --git a/quickshell/Services/BarWidgetService.qml b/quickshell/Services/BarWidgetService.qml index 8ffaa02c9..80033de05 100644 --- a/quickshell/Services/BarWidgetService.qml +++ b/quickshell/Services/BarWidgetService.qml @@ -27,13 +27,15 @@ Singleton { widgetRegistered(widgetId, screenName); } - function unregisterWidget(widgetId, screenName) { + function unregisterWidget(widgetId, screenName, widgetRef) { if (!widgetId || !screenName) return; if (typeof widgetRegistry !== "object" || widgetRegistry === null) return; if (!widgetRegistry[widgetId]) return; + if (widgetRef && widgetRegistry[widgetId][screenName] !== widgetRef) + return; const nextRegistry = Object.assign({}, widgetRegistry); const screenMap = (typeof nextRegistry[widgetId] === "object" && nextRegistry[widgetId] !== null) ? Object.assign({}, nextRegistry[widgetId]) : {};