wip
This commit is contained in:
parent
32edcff102
commit
0296117901
110 changed files with 9713 additions and 5 deletions
63
modules/session/Background.qml
Normal file
63
modules/session/Background.qml
Normal file
|
@ -0,0 +1,63 @@
|
|||
import "root:/services"
|
||||
import "root:/config"
|
||||
import QtQuick
|
||||
import QtQuick.Shapes
|
||||
|
||||
ShapePath {
|
||||
id: root
|
||||
|
||||
required property Wrapper wrapper
|
||||
readonly property real rounding: BorderConfig.rounding
|
||||
readonly property bool flatten: wrapper.width < rounding * 2
|
||||
readonly property real roundingX: flatten ? wrapper.width / 2 : rounding
|
||||
|
||||
strokeWidth: -1
|
||||
fillColor: BorderConfig.colour
|
||||
|
||||
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 * 2
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
119
modules/session/Content.qml
Normal file
119
modules/session/Content.qml
Normal file
|
@ -0,0 +1,119 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
|
||||
import "root:/widgets"
|
||||
import "root:/services"
|
||||
import "root:/config"
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import QtQuick
|
||||
|
||||
Column {
|
||||
id: root
|
||||
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
padding: Appearance.padding.large
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
|
||||
spacing: Appearance.spacing.large
|
||||
|
||||
SessionButton {
|
||||
id: logout
|
||||
|
||||
icon: "logout"
|
||||
command: ["uwsm", "stop"]
|
||||
|
||||
KeyNavigation.down: shutdown
|
||||
|
||||
Connections {
|
||||
target: root.visibilities
|
||||
|
||||
function onSessionChanged(): void {
|
||||
if (root.visibilities.session)
|
||||
logout.focus = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SessionButton {
|
||||
id: shutdown
|
||||
|
||||
icon: "power_settings_new"
|
||||
command: ["systemctl", "poweroff"]
|
||||
|
||||
KeyNavigation.up: logout
|
||||
KeyNavigation.down: hibernate
|
||||
}
|
||||
|
||||
AnimatedImage {
|
||||
width: SessionConfig.sizes.button
|
||||
height: SessionConfig.sizes.button
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
|
||||
playing: visible
|
||||
asynchronous: true
|
||||
speed: 0.7
|
||||
source: "root:/assets/kurukuru.gif"
|
||||
}
|
||||
|
||||
SessionButton {
|
||||
id: hibernate
|
||||
|
||||
icon: "downloading"
|
||||
command: ["systemctl", "hibernate"]
|
||||
|
||||
KeyNavigation.up: shutdown
|
||||
KeyNavigation.down: reboot
|
||||
}
|
||||
|
||||
SessionButton {
|
||||
id: reboot
|
||||
|
||||
icon: "cached"
|
||||
command: ["systemctl", "reboot"]
|
||||
|
||||
KeyNavigation.up: hibernate
|
||||
}
|
||||
|
||||
component SessionButton: StyledRect {
|
||||
id: button
|
||||
|
||||
required property string icon
|
||||
required property list<string> command
|
||||
|
||||
implicitWidth: SessionConfig.sizes.button
|
||||
implicitHeight: SessionConfig.sizes.button
|
||||
|
||||
radius: Appearance.rounding.large
|
||||
color: button.activeFocus ? Colours.palette.m3secondaryContainer : Colours.palette.m3surfaceContainer
|
||||
|
||||
Keys.onEnterPressed: proc.startDetached()
|
||||
Keys.onReturnPressed: proc.startDetached()
|
||||
Keys.onEscapePressed: root.visibilities.session = false
|
||||
|
||||
Process {
|
||||
id: proc
|
||||
|
||||
command: button.command
|
||||
}
|
||||
|
||||
StateLayer {
|
||||
radius: parent.radius
|
||||
|
||||
function onClicked(): void {
|
||||
proc.startDetached();
|
||||
}
|
||||
}
|
||||
|
||||
MaterialIcon {
|
||||
anchors.centerIn: parent
|
||||
|
||||
text: button.icon
|
||||
color: button.activeFocus ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface
|
||||
font.pointSize: Appearance.font.size.extraLarge
|
||||
}
|
||||
}
|
||||
}
|
56
modules/session/Wrapper.qml
Normal file
56
modules/session/Wrapper.qml
Normal file
|
@ -0,0 +1,56 @@
|
|||
import "root:/services"
|
||||
import "root:/config"
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
visible: width > 0
|
||||
implicitWidth: 0
|
||||
implicitHeight: content.implicitHeight
|
||||
|
||||
states: State {
|
||||
name: "visible"
|
||||
when: root.visibilities.session
|
||||
|
||||
PropertyChanges {
|
||||
root.implicitWidth: content.implicitWidth
|
||||
}
|
||||
}
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
from: ""
|
||||
to: "visible"
|
||||
|
||||
NumberAnimation {
|
||||
target: root
|
||||
property: "implicitWidth"
|
||||
duration: Appearance.anim.durations.expressiveFastSpatial
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial
|
||||
}
|
||||
},
|
||||
Transition {
|
||||
from: "visible"
|
||||
to: ""
|
||||
|
||||
NumberAnimation {
|
||||
target: root
|
||||
property: "implicitWidth"
|
||||
duration: root.visibilities.osd ? Appearance.anim.durations.expressiveFastSpatial : Appearance.anim.durations.normal
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: root.visibilities.osd ? Appearance.anim.curves.expressiveFastSpatial : Appearance.anim.curves.emphasized
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Content {
|
||||
id: content
|
||||
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue