diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-07 16:38:10 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-07 16:38:10 +1000 |
| commit | 5dfb3c43edffb9348aa1e3c5ccdfcf51f0dc4346 (patch) | |
| tree | ebbd42d1ba820a42063c49ecf598666d5833bb15 /modules/bar | |
| parent | popouts: fix anim when not shown (diff) | |
| parent | popouts: fix multimonitor (diff) | |
| download | caelestia-shell-5dfb3c43edffb9348aa1e3c5ccdfcf51f0dc4346.tar.gz caelestia-shell-5dfb3c43edffb9348aa1e3c5ccdfcf51f0dc4346.tar.bz2 caelestia-shell-5dfb3c43edffb9348aa1e3c5ccdfcf51f0dc4346.zip | |
Merge pull request #2 from outfoxxed/popouts-multimon
popouts: fix multimonitor
Diffstat (limited to 'modules/bar')
| -rw-r--r-- | modules/bar/Bar.qml | 34 | ||||
| -rw-r--r-- | modules/bar/popouts/Content.qml | 20 | ||||
| -rw-r--r-- | modules/bar/popouts/Wrapper.qml | 4 |
3 files changed, 39 insertions, 19 deletions
diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index c851bbc..2e8ab89 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -1,6 +1,7 @@ import "root:/widgets" import "root:/services" import "root:/config" +import "root:/modules/bar/popouts" as BarPopouts import "components" import "components/workspaces" import Quickshell @@ -10,6 +11,7 @@ Item { id: root required property ShellScreen screen + required property BarPopouts.Wrapper popouts function checkPopout(y: real): void { const spacing = Appearance.spacing.small; @@ -30,30 +32,30 @@ Item { const by = statusIcons.y + statusIconsInner.y + b.y - spacing / 2; if (y >= awy && y <= awy + aw.implicitHeight) { - Popouts.currentName = "activewindow"; - Popouts.currentCenter = Qt.binding(() => activeWindow.y + aw.y + aw.implicitHeight / 2); - Popouts.hasCurrent = true; + popouts.currentName = "activewindow"; + popouts.currentCenter = Qt.binding(() => activeWindow.y + aw.y + aw.implicitHeight / 2); + popouts.hasCurrent = true; } else if (y > ty && y < ty + th) { const index = Math.floor(((y - ty) / th) * trayItems.count); const item = trayItems.itemAt(index); - Popouts.currentName = `traymenu${index}`; - Popouts.currentCenter = Qt.binding(() => tray.y + item.y + item.implicitHeight / 2); - Popouts.hasCurrent = true; + popouts.currentName = `traymenu${index}`; + popouts.currentCenter = Qt.binding(() => tray.y + item.y + item.implicitHeight / 2); + popouts.hasCurrent = true; } else if (y >= ny && y <= ny + n.implicitHeight + spacing) { - Popouts.currentName = "network"; - Popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + n.y + n.implicitHeight / 2); - Popouts.hasCurrent = true; + popouts.currentName = "network"; + popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + n.y + n.implicitHeight / 2); + popouts.hasCurrent = true; } else if (y >= bls && y <= ble) { - Popouts.currentName = "bluetooth"; - Popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + statusIconsInner.bs + (statusIconsInner.be - statusIconsInner.bs) / 2); - Popouts.hasCurrent = true; + popouts.currentName = "bluetooth"; + popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + statusIconsInner.bs + (statusIconsInner.be - statusIconsInner.bs) / 2); + popouts.hasCurrent = true; } else if (y >= by && y <= by + b.implicitHeight + spacing) { - Popouts.currentName = "battery"; - Popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + b.y + b.implicitHeight / 2); - Popouts.hasCurrent = true; + popouts.currentName = "battery"; + popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + b.y + b.implicitHeight / 2); + popouts.hasCurrent = true; } else { - Popouts.hasCurrent = false; + popouts.hasCurrent = false; } } diff --git a/modules/bar/popouts/Content.qml b/modules/bar/popouts/Content.qml index a3ddea4..086a558 100644 --- a/modules/bar/popouts/Content.qml +++ b/modules/bar/popouts/Content.qml @@ -11,9 +11,23 @@ Item { required property ShellScreen screen + property string currentName + property real currentCenter + property bool hasCurrent + + Behavior on currentCenter { + enabled: root.hasCurrent + + NumberAnimation { + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.emphasized + } + } + anchors.centerIn: parent - implicitWidth: Popouts.hasCurrent ? (content.children.find(c => c.shouldBeActive)?.implicitWidth ?? 0) + Appearance.padding.large * 2 : 0 + implicitWidth: root.hasCurrent ? (content.children.find(c => c.shouldBeActive)?.implicitWidth ?? 0) + Appearance.padding.large * 2 : 0 implicitHeight: (content.children.find(c => c.shouldBeActive)?.implicitHeight ?? 0) + Appearance.padding.large * 2 Item { @@ -70,7 +84,7 @@ Item { } Behavior on implicitHeight { - enabled: Popouts.hasCurrent + enabled: root.hasCurrent Anim { easing.bezierCurve: Appearance.anim.curves.emphasized @@ -81,7 +95,7 @@ Item { id: popout required property string name - property bool shouldBeActive: Popouts.currentName === name + property bool shouldBeActive: root.currentName === name anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right diff --git a/modules/bar/popouts/Wrapper.qml b/modules/bar/popouts/Wrapper.qml index 47b8af2..f304ea7 100644 --- a/modules/bar/popouts/Wrapper.qml +++ b/modules/bar/popouts/Wrapper.qml @@ -8,6 +8,10 @@ Item { required property ShellScreen screen + property alias currentName: content.currentName + property alias currentCenter: content.currentCenter + property alias hasCurrent: content.hasCurrent + visible: width > 0 && height > 0 implicitWidth: content.implicitWidth |