summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.lock5
-rw-r--r--modules/lock/Content.qml66
-rw-r--r--modules/lock/Media.qml208
-rw-r--r--modules/lock/Resources.qml93
4 files changed, 2 insertions, 370 deletions
diff --git a/flake.lock b/flake.lock
index b3a5ae3..9a7154f 100644
--- a/flake.lock
+++ b/flake.lock
@@ -16,9 +16,8 @@
"type": "github"
},
"original": {
- "owner": "caelestia-dots",
- "repo": "cli",
- "type": "github"
+ "type": "git",
+ "url": "https://g.freya.cat/caelestia-cli"
}
},
"nixpkgs": {
diff --git a/modules/lock/Content.qml b/modules/lock/Content.qml
index a024ddc..daa87ac 100644
--- a/modules/lock/Content.qml
+++ b/modules/lock/Content.qml
@@ -14,46 +14,6 @@ RowLayout {
ColumnLayout {
Layout.fillWidth: true
spacing: Appearance.spacing.normal
-
- StyledRect {
- Layout.fillWidth: true
- implicitHeight: weather.implicitHeight
-
- topLeftRadius: Appearance.rounding.large
- radius: Appearance.rounding.small
- color: Colours.tPalette.m3surfaceContainer
-
- WeatherInfo {
- id: weather
-
- rootHeight: root.height
- }
- }
-
- StyledRect {
- Layout.fillWidth: true
- Layout.fillHeight: true
-
- radius: Appearance.rounding.small
- color: Colours.tPalette.m3surfaceContainer
-
- Fetch {}
- }
-
- StyledClippingRect {
- Layout.fillWidth: true
- implicitHeight: media.implicitHeight
-
- bottomLeftRadius: Appearance.rounding.large
- radius: Appearance.rounding.small
- color: Colours.tPalette.m3surfaceContainer
-
- Media {
- id: media
-
- lock: root.lock
- }
- }
}
Center {
@@ -63,31 +23,5 @@ RowLayout {
ColumnLayout {
Layout.fillWidth: true
spacing: Appearance.spacing.normal
-
- StyledRect {
- Layout.fillWidth: true
- implicitHeight: resources.implicitHeight
-
- topRightRadius: Appearance.rounding.large
- radius: Appearance.rounding.small
- color: Colours.tPalette.m3surfaceContainer
-
- Resources {
- id: resources
- }
- }
-
- StyledRect {
- Layout.fillWidth: true
- Layout.fillHeight: true
-
- bottomRightRadius: Appearance.rounding.large
- radius: Appearance.rounding.small
- color: Colours.tPalette.m3surfaceContainer
-
- NotifDock {
- lock: root.lock
- }
- }
}
}
diff --git a/modules/lock/Media.qml b/modules/lock/Media.qml
deleted file mode 100644
index b7e58bb..0000000
--- a/modules/lock/Media.qml
+++ /dev/null
@@ -1,208 +0,0 @@
-pragma ComponentBehavior: Bound
-
-import qs.components
-import qs.components.effects
-import qs.services
-import qs.config
-import QtQuick
-import QtQuick.Layouts
-
-Item {
- id: root
-
- required property var lock
-
- anchors.left: parent.left
- anchors.right: parent.right
- implicitHeight: layout.implicitHeight
-
- Image {
- anchors.fill: parent
- source: Players.active?.trackArtUrl ?? ""
-
- asynchronous: true
- fillMode: Image.PreserveAspectCrop
- sourceSize.width: width
- sourceSize.height: height
-
- layer.enabled: true
- layer.effect: OpacityMask {
- maskSource: mask
- }
-
- opacity: status === Image.Ready ? 1 : 0
-
- Behavior on opacity {
- Anim {
- duration: Appearance.anim.durations.extraLarge
- }
- }
- }
-
- Rectangle {
- id: mask
-
- anchors.fill: parent
- layer.enabled: true
- visible: false
-
- gradient: Gradient {
- orientation: Gradient.Horizontal
-
- GradientStop {
- position: 0
- color: Qt.rgba(0, 0, 0, 0.5)
- }
- GradientStop {
- position: 0.4
- color: Qt.rgba(0, 0, 0, 0.2)
- }
- GradientStop {
- position: 0.8
- color: Qt.rgba(0, 0, 0, 0)
- }
- }
- }
-
- ColumnLayout {
- id: layout
-
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.margins: Appearance.padding.large
-
- StyledText {
- Layout.topMargin: Appearance.padding.large
- Layout.bottomMargin: Appearance.spacing.larger
- text: qsTr("Now playing")
- color: Colours.palette.m3onSurfaceVariant
- font.family: Appearance.font.family.mono
- font.weight: 500
- }
-
- StyledText {
- Layout.fillWidth: true
- animate: true
- text: Players.active?.trackArtist ?? qsTr("No media")
- color: Colours.palette.m3primary
- horizontalAlignment: Text.AlignHCenter
- font.pointSize: Appearance.font.size.large
- font.family: Appearance.font.family.mono
- font.weight: 600
- elide: Text.ElideRight
- }
-
- StyledText {
- Layout.fillWidth: true
- animate: true
- text: Players.active?.trackTitle ?? qsTr("No media")
- horizontalAlignment: Text.AlignHCenter
- font.pointSize: Appearance.font.size.larger
- font.family: Appearance.font.family.mono
- elide: Text.ElideRight
- }
-
- RowLayout {
- Layout.alignment: Qt.AlignHCenter
- Layout.topMargin: Appearance.spacing.large * 1.2
- Layout.bottomMargin: Appearance.padding.large
-
- spacing: Appearance.spacing.large
-
- PlayerControl {
- icon: "skip_previous"
-
- function onClicked(): void {
- if (Players.active?.canGoPrevious)
- Players.active.previous();
- }
- }
-
- PlayerControl {
- animate: true
- icon: active ? "pause" : "play_arrow"
- colour: "Primary"
- level: active ? 2 : 1
- active: Players.active?.isPlaying ?? false
-
- function onClicked(): void {
- if (Players.active?.canTogglePlaying)
- Players.active.togglePlaying();
- }
- }
-
- PlayerControl {
- icon: "skip_next"
-
- function onClicked(): void {
- if (Players.active?.canGoNext)
- Players.active.next();
- }
- }
- }
- }
-
- component PlayerControl: StyledRect {
- id: control
-
- property alias animate: controlIcon.animate
- property alias icon: controlIcon.text
- property bool active
- property string colour: "Secondary"
- property int level: 1
-
- function onClicked(): void {
- }
-
- Layout.preferredWidth: implicitWidth + (controlState.pressed ? Appearance.padding.normal * 2 : active ? Appearance.padding.small * 2 : 0)
- implicitWidth: controlIcon.implicitWidth + Appearance.padding.large * 2
- implicitHeight: controlIcon.implicitHeight + Appearance.padding.normal * 2
-
- color: active ? Colours.palette[`m3${colour.toLowerCase()}`] : Colours.palette[`m3${colour.toLowerCase()}Container`]
- radius: active || controlState.pressed ? Appearance.rounding.normal : Math.min(implicitWidth, implicitHeight) / 2 * Math.min(1, Appearance.rounding.scale)
-
- Elevation {
- anchors.fill: parent
- radius: parent.radius
- z: -1
- level: controlState.containsMouse && !controlState.pressed ? control.level + 1 : control.level
- }
-
- StateLayer {
- id: controlState
-
- color: control.active ? Colours.palette[`m3on${control.colour}`] : Colours.palette[`m3on${control.colour}Container`]
-
- function onClicked(): void {
- control.onClicked();
- }
- }
-
- MaterialIcon {
- id: controlIcon
-
- anchors.centerIn: parent
- color: control.active ? Colours.palette[`m3on${control.colour}`] : Colours.palette[`m3on${control.colour}Container`]
- font.pointSize: Appearance.font.size.large
- fill: control.active ? 1 : 0
-
- Behavior on fill {
- Anim {}
- }
- }
-
- Behavior on Layout.preferredWidth {
- Anim {
- duration: Appearance.anim.durations.expressiveFastSpatial
- easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial
- }
- }
-
- Behavior on radius {
- Anim {
- duration: Appearance.anim.durations.expressiveFastSpatial
- easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial
- }
- }
- }
-}
diff --git a/modules/lock/Resources.qml b/modules/lock/Resources.qml
deleted file mode 100644
index 82c004c..0000000
--- a/modules/lock/Resources.qml
+++ /dev/null
@@ -1,93 +0,0 @@
-import qs.components
-import qs.components.controls
-import qs.components.misc
-import qs.services
-import qs.config
-import QtQuick
-import QtQuick.Layouts
-
-GridLayout {
- id: root
-
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.margins: Appearance.padding.large
-
- rowSpacing: Appearance.spacing.large
- columnSpacing: Appearance.spacing.large
- rows: 2
- columns: 2
-
- Ref {
- service: SystemUsage
- }
-
- Resource {
- Layout.topMargin: Appearance.padding.large
- icon: "memory"
- value: SystemUsage.cpuPerc
- colour: Colours.palette.m3primary
- }
-
- Resource {
- Layout.topMargin: Appearance.padding.large
- icon: "thermostat"
- value: Math.min(1, SystemUsage.cpuTemp / 90)
- colour: Colours.palette.m3secondary
- }
-
- Resource {
- Layout.bottomMargin: Appearance.padding.large
- icon: "memory_alt"
- value: SystemUsage.memPerc
- colour: Colours.palette.m3secondary
- }
-
- Resource {
- Layout.bottomMargin: Appearance.padding.large
- icon: "hard_disk"
- value: SystemUsage.storagePerc
- colour: Colours.palette.m3tertiary
- }
-
- component Resource: StyledRect {
- id: res
-
- required property string icon
- required property real value
- required property color colour
-
- Layout.fillWidth: true
- implicitHeight: width
-
- color: Colours.layer(Colours.palette.m3surfaceContainerHigh, 2)
- radius: Appearance.rounding.large
-
- CircularProgress {
- id: circ
-
- anchors.fill: parent
- value: res.value
- padding: Appearance.padding.large * 3
- fgColour: res.colour
- bgColour: Colours.layer(Colours.palette.m3surfaceContainerHighest, 3)
- strokeWidth: width < 200 ? Appearance.padding.smaller : Appearance.padding.normal
- }
-
- MaterialIcon {
- id: icon
-
- anchors.centerIn: parent
- text: res.icon
- color: res.colour
- font.pointSize: (circ.arcRadius * 0.7) || 1
- font.weight: 600
- }
-
- Behavior on value {
- Anim {
- duration: Appearance.anim.durations.large
- }
- }
- }
-}