From a61860ea8ad4c91a0a25faf8b0a0e869236f8c07 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Mon, 14 Jul 2025 22:03:18 +0800 Subject: Revert "activewindow: properly use loader" This reverts commit a79f63360e3e20f35ae36611ed66a9bd3421f3c3. --- bar/ActiveWindow.qml | 63 +++++++++++++++++++++++----------------------------- bar/Bar.qml | 8 ++++++- 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/bar/ActiveWindow.qml b/bar/ActiveWindow.qml index e0b917d..4bc3f09 100644 --- a/bar/ActiveWindow.qml +++ b/bar/ActiveWindow.qml @@ -7,46 +7,39 @@ import Quickshell.Widgets import qs.components import qs.config -Loader { - id: activeWindowLoader - anchors.centerIn: parent - active: ToplevelManager.activeToplevel?.activated ? 1 : 0 - sourceComponent: Component { - Rectangle { - id: root - property var toplevel: Hyprland.activeToplevel - property var icon: Quickshell.iconPath(AppSearch.guessIcon(toplevel?.wayland?.appId), "image-missing") +Rectangle { + id: root + property var toplevel: Hyprland.activeToplevel + property var icon: Quickshell.iconPath(AppSearch.guessIcon(toplevel?.wayland?.appId), "image-missing") - // use IRect - implicitWidth: rowLayout.implicitWidth + General.rectMargin * 4 - implicitHeight: rowLayout.implicitHeight + General.rectMargin * 2 - anchors.centerIn: parent + // use IRect + implicitWidth: rowLayout.implicitWidth + General.rectMargin * 4 + implicitHeight: rowLayout.implicitHeight + General.rectMargin * 2 + anchors.centerIn: parent - color: Colors.alt - // according to docs, null could happen but doesn't seem to happen in practice so.. - // hypr toplevel.activated is always true and doesn't change either so.. - // opacity: ToplevelManager.activeToplevel?.activated ? 1 : 0 + color: Colors.alt + // according to docs, null could happen but doesn't seem to happen in practice so.. + // hypr toplevel.activated is always true and doesn't change either so.. + opacity: ToplevelManager.activeToplevel?.activated ? 1 : 0 - radius: Style.rounding.smaller + radius: Style.rounding.smaller - RowLayout { - id: rowLayout - anchors.centerIn: parent - spacing: Bar.resourceIconTextSpacing + RowLayout { + id: rowLayout + anchors.centerIn: parent + spacing: Bar.resourceIconTextSpacing - IconImage { - source: root.icon - implicitWidth: Bar.appIconSize - implicitHeight: Bar.appIconSize - Layout.fillHeight: true - Layout.fillWidth: false - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - } - IText { - font.pixelSize: General.fontSize - text: root?.toplevel?.wayland?.title || "" - } - } + IconImage { + source: root.icon + implicitWidth: Bar.appIconSize + implicitHeight: Bar.appIconSize + Layout.fillHeight: true + Layout.fillWidth: false + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + } + IText { + font.pixelSize: General.fontSize + text: root?.toplevel?.wayland?.title || "" } } } diff --git a/bar/Bar.qml b/bar/Bar.qml index 1146c8d..4f523ea 100644 --- a/bar/Bar.qml +++ b/bar/Bar.qml @@ -76,7 +76,13 @@ Scope { id: centerRow anchors.centerIn: parent - ActiveWindow {} + Loader { + active: activeWindow.opacity === 1 + + ActiveWindow { + id: activeWindow + } + } } Rectangle { -- cgit v1.2.3