diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-13 19:01:00 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-13 19:01:00 +1000 |
| commit | 3fd429c9f30e1b8cffdeca2778c7eb20f8a0647f (patch) | |
| tree | e2c2c8d8e812c7ed960b49686a159b9acaba7b09 /modules | |
| parent | notifs: move to drawers (diff) | |
| download | caelestia-shell-3fd429c9f30e1b8cffdeca2778c7eb20f8a0647f.tar.gz caelestia-shell-3fd429c9f30e1b8cffdeca2778c7eb20f8a0647f.tar.bz2 caelestia-shell-3fd429c9f30e1b8cffdeca2778c7eb20f8a0647f.zip | |
session: move to drawers
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/Shortcuts.qml | 14 | ||||
| -rw-r--r-- | modules/drawers/Backgrounds.qml | 12 | ||||
| -rw-r--r-- | modules/drawers/Drawers.qml | 4 | ||||
| -rw-r--r-- | modules/drawers/Panels.qml | 17 | ||||
| -rw-r--r-- | modules/notifications/Wrapper.qml | 1 | ||||
| -rw-r--r-- | modules/session/Background.qml | 105 | ||||
| -rw-r--r-- | modules/session/Content.qml | 10 | ||||
| -rw-r--r-- | modules/session/Session.qml | 87 | ||||
| -rw-r--r-- | modules/session/Wrapper.qml | 56 |
9 files changed, 121 insertions, 185 deletions
diff --git a/modules/Shortcuts.qml b/modules/Shortcuts.qml new file mode 100644 index 0000000..f97f825 --- /dev/null +++ b/modules/Shortcuts.qml @@ -0,0 +1,14 @@ +import "root:/widgets" +import "root:/services" +import Quickshell + +Scope { + CustomShortcut { + name: "session" + description: "Toggle session menu" + onPressed: { + const visibilities = Visibilities.getForActive(); + visibilities.session = !visibilities.session; + } + } +} diff --git a/modules/drawers/Backgrounds.qml b/modules/drawers/Backgrounds.qml index 94d8dee..017b883 100644 --- a/modules/drawers/Backgrounds.qml +++ b/modules/drawers/Backgrounds.qml @@ -2,6 +2,7 @@ import "root:/services" import "root:/config" import "root:/modules/osd" as Osd import "root:/modules/notifications" as Notifications +import "root:/modules/session" as Session import Quickshell import QtQuick import QtQuick.Shapes @@ -19,8 +20,8 @@ Shape { Osd.Background { wrapper: panels.osd - startX: root.width - startY: (root.height - panels.osd.height) / 2 + startX: root.width - panels.session.width + startY: (root.height - wrapper.height) / 2 } Notifications.Background { @@ -29,4 +30,11 @@ Shape { startX: root.width startY: 0 } + + Session.Background { + wrapper: panels.session + + startX: root.width + startY: (root.height - wrapper.height) / 2 + } } diff --git a/modules/drawers/Drawers.qml b/modules/drawers/Drawers.qml index fe70b8c..5aa5b50 100644 --- a/modules/drawers/Drawers.qml +++ b/modules/drawers/Drawers.qml @@ -4,6 +4,7 @@ import "root:/widgets" import "root:/services" import "root:/config" import Quickshell +import Quickshell.Wayland import QtQuick Variants { @@ -24,6 +25,7 @@ Variants { screen: scope.modelData name: "drawers" exclusionMode: ExclusionMode.Ignore + keyboardFocus: visibilities.launcher || visibilities.session ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None mask: Region { x: BorderConfig.thickness @@ -77,6 +79,8 @@ Variants { property bool osd property bool notifications: Notifs.popups.length > 0 property bool session + + Component.onCompleted: Visibilities.screens[scope.modelData] = this } Interactions { diff --git a/modules/drawers/Panels.qml b/modules/drawers/Panels.qml index 645af21..fb1a9f5 100644 --- a/modules/drawers/Panels.qml +++ b/modules/drawers/Panels.qml @@ -1,6 +1,7 @@ import "root:/config" import "root:/modules/osd" as Osd import "root:/modules/notifications" as Notifications +import "root:/modules/session" as Session import Quickshell import QtQuick @@ -12,6 +13,7 @@ Item { readonly property Osd.Wrapper osd: osd readonly property Notifications.Wrapper notifications: notifications + readonly property Session.Wrapper session: session anchors.fill: parent anchors.margins: BorderConfig.thickness @@ -20,19 +22,28 @@ Item { id: osd screen: root.screen - visibility: visibilities.osd + visibility: root.visibilities.osd anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right + anchors.rightMargin: session.width } Notifications.Wrapper { id: notifications - screen: root.screen - visibility: visibilities.notifications + visibility: root.visibilities.notifications anchors.top: parent.top anchors.right: parent.right } + + Session.Wrapper { + id: session + + visibilities: root.visibilities + + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + } } diff --git a/modules/notifications/Wrapper.qml b/modules/notifications/Wrapper.qml index e333560..1ad6092 100644 --- a/modules/notifications/Wrapper.qml +++ b/modules/notifications/Wrapper.qml @@ -5,7 +5,6 @@ import QtQuick Item { id: root - required property ShellScreen screen required property bool visibility visible: height > 0 diff --git a/modules/session/Background.qml b/modules/session/Background.qml index 4b4b92e..75940d3 100644 --- a/modules/session/Background.qml +++ b/modules/session/Background.qml @@ -3,68 +3,61 @@ import "root:/config" import QtQuick import QtQuick.Shapes -Shape { +ShapePath { id: root - required property real wrapperWidth - required property real wrapperHeight + required property Wrapper wrapper readonly property real rounding: BorderConfig.rounding - readonly property bool flatten: wrapperWidth < rounding * 2 - readonly property real roundingX: flatten ? wrapperWidth / 2 : rounding + readonly property bool flatten: wrapper.width < rounding * 2 + readonly property real roundingX: flatten ? wrapper.width / 2 : rounding - preferredRendererType: Shape.CurveRenderer - opacity: Colours.transparency.enabled ? Colours.transparency.base : 1 + strokeWidth: -1 + fillColor: BorderConfig.colour - ShapePath { - strokeWidth: -1 - fillColor: BorderConfig.colour - - startX: root.wrapperWidth - 1 - - PathArc { - relativeX: -root.roundingX - relativeY: root.rounding - radiusX: Math.min(root.rounding, root.wrapperWidth) - radiusY: root.rounding - } - PathLine { - x: root.roundingX - relativeY: 0 - } - PathArc { - relativeX: -root.roundingX - relativeY: root.rounding - radiusX: Math.min(root.rounding, root.wrapperWidth) - radiusY: root.rounding - direction: PathArc.Counterclockwise - } - PathLine { - y: root.wrapperHeight - root.rounding * 2 - } - PathArc { - relativeX: root.roundingX - relativeY: root.rounding - radiusX: Math.min(root.rounding, root.wrapperWidth) - radiusY: root.rounding - direction: PathArc.Counterclockwise - } - PathLine { - x: (root.flatten ? root.roundingX : root.wrapperWidth - root.rounding) - 1 - relativeY: 0 - } - PathArc { - relativeX: root.roundingX - relativeY: root.rounding - radiusX: Math.min(root.rounding, root.wrapperWidth) - radiusY: root.rounding - } + PathArc { + relativeX: -root.roundingX + relativeY: root.rounding + radiusX: Math.min(root.rounding, root.wrapper.width) + radiusY: root.rounding + } + PathLine { + relativeX: -(root.wrapper.width - root.roundingX * 2) + relativeY: 0 + } + PathArc { + relativeX: -root.roundingX + relativeY: root.rounding + radiusX: Math.min(root.rounding, root.wrapper.width) + radiusY: root.rounding + direction: PathArc.Counterclockwise + } + PathLine { + relativeX: 0 + relativeY: root.wrapper.height - root.rounding * 4 + } + PathArc { + relativeX: root.roundingX + relativeY: root.rounding + radiusX: Math.min(root.rounding, root.wrapper.width) + radiusY: root.rounding + direction: PathArc.Counterclockwise + } + PathLine { + relativeX: root.wrapper.width - root.roundingX * 2 + relativeY: 0 + } + PathArc { + relativeX: root.roundingX + relativeY: root.rounding + radiusX: Math.min(root.rounding, root.wrapper.width) + radiusY: root.rounding + } - Behavior on fillColor { - ColorAnimation { - duration: Appearance.anim.durations.normal - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.anim.curves.standard - } + Behavior on fillColor { + ColorAnimation { + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standard } } } diff --git a/modules/session/Content.qml b/modules/session/Content.qml index 64f877c..4f4747c 100644 --- a/modules/session/Content.qml +++ b/modules/session/Content.qml @@ -10,7 +10,7 @@ import QtQuick Column { id: root - required property Scope session + required property PersistentProperties visibilities padding: Appearance.padding.large @@ -28,10 +28,10 @@ Column { KeyNavigation.down: shutdown Connections { - target: session + target: root.visibilities - function onSessionVisibleChanged(): void { - if (session.sessionVisible) + function onSessionChanged(): void { + if (root.visibilities.session) logout.focus = true; } } @@ -92,7 +92,7 @@ Column { Keys.onEnterPressed: proc.startDetached() Keys.onReturnPressed: proc.startDetached() - Keys.onEscapePressed: root.session.sessionVisible = false + Keys.onEscapePressed: root.visibilities.session = false Process { id: proc diff --git a/modules/session/Session.qml b/modules/session/Session.qml deleted file mode 100644 index 8a6674c..0000000 --- a/modules/session/Session.qml +++ /dev/null @@ -1,87 +0,0 @@ -import "root:/widgets" -import "root:/services" -import "root:/config" -import Quickshell -import Quickshell.Wayland -import QtQuick - -Scope { - id: root - - property int winHeight - property bool sessionVisible - - // Connections { - // target: Drawers - - // function onPosChanged(screen: ShellScreen, x: int, y: int): void { - // if (x > screen.width - BorderConfig.thickness && y > (screen.height - root.winHeight) / 2 && y < (screen.height + root.winHeight) / 2) - // root.sessionVisible = true; - // } - // } - - LazyLoader { - loading: true - - StyledWindow { - id: win - - name: "osd" - keyboardFocus: root.sessionVisible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None - visible: wrapper.shouldBeVisible - - mask: Region { - item: wrapper - } - - anchors.left: true - anchors.right: true - height: wrapper.height - - Component.onCompleted: { - root.winHeight = height; - Drawers.rightExclusion = Qt.binding(() => bg.width); - } - - Background { - id: bg - - visible: false - - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - - wrapperWidth: Math.min(wrapper.width, content.width) - wrapperHeight: wrapper.height - } - - LayerShadow { - source: bg - } - - Wrapper { - id: wrapper - - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - - implicitHeight: content.height + bg.rounding * 2 - - sessionVisible: root.sessionVisible - contentWidth: content.width - - Content { - id: content - - session: root - } - } - } - } - - CustomShortcut { - name: "session" - description: "Toggle session menu" - onPressed: root.sessionVisible = !root.sessionVisible - } -} diff --git a/modules/session/Wrapper.qml b/modules/session/Wrapper.qml index 5806972..4f81d1a 100644 --- a/modules/session/Wrapper.qml +++ b/modules/session/Wrapper.qml @@ -1,23 +1,23 @@ +import "root:/services" import "root:/config" +import Quickshell import QtQuick Item { id: root - required property bool sessionVisible - required property real contentWidth - property bool shouldBeVisible + required property PersistentProperties visibilities visible: width > 0 - width: 0 + implicitWidth: 0 + implicitHeight: content.height + BorderConfig.rounding * 2 states: State { name: "visible" - when: root.sessionVisible + when: root.visibilities.session PropertyChanges { - root.width: contentWidth - root.shouldBeVisible: true + root.implicitWidth: content.width } } @@ -26,37 +26,31 @@ Item { from: "" to: "visible" - SequentialAnimation { - PropertyAction { - target: root - property: "shouldBeVisible" - } - NumberAnimation { - target: root - property: "width" - duration: Appearance.anim.durations.large - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.anim.curves.emphasizedDecel - } + NumberAnimation { + target: root + property: "implicitWidth" + duration: Appearance.anim.durations.large + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.emphasizedDecel } }, Transition { from: "visible" to: "" - SequentialAnimation { - NumberAnimation { - target: root - property: "width" - duration: Appearance.anim.durations.normal - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.anim.curves.emphasizedAccel - } - PropertyAction { - target: root - property: "shouldBeVisible" - } + NumberAnimation { + target: root + property: "implicitWidth" + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.emphasizedAccel } } ] + + Content { + id: content + + visibilities: root.visibilities + } } |