nosignal-shell/modules/bar/BarWrapper.qml
Laurens Duin 3710df29f5
bar: allow hiding items and reordering (#379)
* feat: reorder bar, no popout yet

* chore: cleanup

* refactor: use DelegateChooser

* feat: popouts

* chore: cleanup

* better popout check + fix async stuff + bar interaction

+ a bunch of other fixes

* fix activewindow and bar vertical padding

* readme: add config opt

* bar: fix top/bottom padding

* bar: better wheel behaviour

---------

Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
2025-08-13 14:31:48 +10:00

83 lines
2.2 KiB
QML

pragma ComponentBehavior: Bound
import qs.services
import qs.config
import "popouts" as BarPopouts
import Quickshell
import QtQuick
Item {
id: root
required property ShellScreen screen
required property PersistentProperties visibilities
required property BarPopouts.Wrapper popouts
readonly property int exclusiveZone: Config.bar.persistent || visibilities.bar ? content.implicitWidth : Config.border.thickness
readonly property bool shouldBeVisible: Config.bar.persistent || visibilities.bar || isHovered
property bool isHovered
function checkPopout(y: real): void {
content.item?.checkPopout(y);
}
function handleWheel(y: real, angleDelta: point): void {
content.item?.handleWheel(y, angleDelta);
}
visible: width > Config.border.thickness
implicitWidth: Config.border.thickness
implicitHeight: content.implicitHeight
states: State {
name: "visible"
when: root.shouldBeVisible
PropertyChanges {
root.implicitWidth: content.implicitWidth
}
}
transitions: [
Transition {
from: ""
to: "visible"
NumberAnimation {
target: root
property: "implicitWidth"
duration: Appearance.anim.durations.expressiveDefaultSpatial
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
}
},
Transition {
from: "visible"
to: ""
NumberAnimation {
target: root
property: "implicitWidth"
duration: Appearance.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.emphasized
}
}
]
Loader {
id: content
Component.onCompleted: active = Qt.binding(() => root.shouldBeVisible || root.visible)
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
sourceComponent: Bar {
screen: root.screen
visibilities: root.visibilities
popouts: root.popouts
}
}
}