summaryrefslogtreecommitdiff
path: root/modules/session
diff options
context:
space:
mode:
Diffstat (limited to 'modules/session')
-rw-r--r--modules/session/Background.qml105
-rw-r--r--modules/session/Content.qml10
-rw-r--r--modules/session/Session.qml87
-rw-r--r--modules/session/Wrapper.qml56
4 files changed, 79 insertions, 179 deletions
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
+ }
}