diff options
| author | Freya Murphy <freya@freyacat.org> | 2026-01-08 16:00:05 -0500 |
|---|---|---|
| committer | Freya Murphy <freya@freyacat.org> | 2026-01-08 16:00:05 -0500 |
| commit | 079625ae2165c7552e8f9a8a2517644e2ed0bab7 (patch) | |
| tree | 4c40df7838ff3638380eedcdec7534443a4533bc | |
| parent | init fork (diff) | |
| download | caelestia-shell-079625ae2165c7552e8f9a8a2517644e2ed0bab7.tar.gz caelestia-shell-079625ae2165c7552e8f9a8a2517644e2ed0bab7.tar.bz2 caelestia-shell-079625ae2165c7552e8f9a8a2517644e2ed0bab7.zip | |
clean up lock screen
| -rw-r--r-- | flake.lock | 18 | ||||
| -rw-r--r-- | modules/lock/Content.qml | 66 | ||||
| -rw-r--r-- | modules/lock/Fetch.qml | 166 | ||||
| -rw-r--r-- | modules/lock/Media.qml | 208 | ||||
| -rw-r--r-- | modules/lock/NotifDock.qml | 146 | ||||
| -rw-r--r-- | modules/lock/NotifGroup.qml | 319 | ||||
| -rw-r--r-- | modules/lock/Resources.qml | 93 | ||||
| -rw-r--r-- | modules/lock/WeatherInfo.qml | 179 |
8 files changed, 9 insertions, 1186 deletions
@@ -8,17 +8,17 @@ ] }, "locked": { - "lastModified": 1767320190, - "narHash": "sha256-HXi1ED3ub/7yn3SEUw8641dLMFuxRlcMs/RgIbU91I8=", - "owner": "caelestia-dots", - "repo": "cli", - "rev": "337c711371e070fa28c2e55fffc5b0115a7cf40b", - "type": "github" + "lastModified": 1767905196, + "narHash": "sha256-72Z9vz1dq9FtLc7rjU9GwErUNmKZd6ZBIX1tUznwq7U=", + "ref": "refs/heads/main", + "rev": "8056a87db5c2f6a8df23f2b6b1867471e2b8995d", + "revCount": 419, + "type": "git", + "url": "https://g.freya.cat/caelestia-cli" }, "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/Fetch.qml b/modules/lock/Fetch.qml deleted file mode 100644 index 0e64343..0000000 --- a/modules/lock/Fetch.qml +++ /dev/null @@ -1,166 +0,0 @@ -pragma ComponentBehavior: Bound - -import qs.components -import qs.components.effects -import qs.services -import qs.config -import qs.utils -import Quickshell.Services.UPower -import QtQuick -import QtQuick.Layouts - -ColumnLayout { - id: root - - anchors.fill: parent - anchors.margins: Appearance.padding.large * 2 - anchors.topMargin: Appearance.padding.large - - spacing: Appearance.spacing.small - - RowLayout { - Layout.fillWidth: true - Layout.fillHeight: false - spacing: Appearance.spacing.normal - - StyledRect { - implicitWidth: prompt.implicitWidth + Appearance.padding.normal * 2 - implicitHeight: prompt.implicitHeight + Appearance.padding.normal * 2 - - color: Colours.palette.m3primary - radius: Appearance.rounding.small - - MonoText { - id: prompt - - anchors.centerIn: parent - text: ">" - font.pointSize: root.width > 400 ? Appearance.font.size.larger : Appearance.font.size.normal - color: Colours.palette.m3onPrimary - } - } - - MonoText { - Layout.fillWidth: true - text: "caelestiafetch.sh" - font.pointSize: root.width > 400 ? Appearance.font.size.larger : Appearance.font.size.normal - elide: Text.ElideRight - } - - WrappedLoader { - Layout.fillHeight: true - active: !iconLoader.active - - sourceComponent: OsLogo {} - } - } - - RowLayout { - Layout.fillWidth: true - Layout.fillHeight: false - spacing: height * 0.15 - - WrappedLoader { - id: iconLoader - - Layout.fillHeight: true - active: root.width > 320 - - sourceComponent: OsLogo {} - } - - ColumnLayout { - Layout.fillWidth: true - Layout.topMargin: Appearance.padding.normal - Layout.bottomMargin: Appearance.padding.normal - Layout.leftMargin: iconLoader.active ? 0 : width * 0.1 - spacing: Appearance.spacing.normal - - WrappedLoader { - Layout.fillWidth: true - active: !batLoader.active && root.height > 200 - - sourceComponent: FetchText { - text: `OS : ${SysInfo.osPrettyName || SysInfo.osName}` - } - } - - WrappedLoader { - Layout.fillWidth: true - active: root.height > (batLoader.active ? 200 : 110) - - sourceComponent: FetchText { - text: `WM : ${SysInfo.wm}` - } - } - - WrappedLoader { - Layout.fillWidth: true - active: !batLoader.active || root.height > 110 - - sourceComponent: FetchText { - text: `USER: ${SysInfo.user}` - } - } - - FetchText { - text: `UP : ${SysInfo.uptime}` - } - - WrappedLoader { - id: batLoader - - Layout.fillWidth: true - active: UPower.displayDevice.isLaptopBattery - - sourceComponent: FetchText { - text: `BATT: ${[UPowerDeviceState.Charging, UPowerDeviceState.FullyCharged, UPowerDeviceState.PendingCharge].includes(UPower.displayDevice.state) ? "(+) " : ""}${Math.round(UPower.displayDevice.percentage * 100)}%` - } - } - } - } - - WrappedLoader { - Layout.alignment: Qt.AlignHCenter - active: root.height > 180 - - sourceComponent: RowLayout { - spacing: Appearance.spacing.large - - Repeater { - model: Math.max(0, Math.min(8, root.width / (Appearance.font.size.larger * 2 + Appearance.spacing.large))) - - StyledRect { - required property int index - - implicitWidth: implicitHeight - implicitHeight: Appearance.font.size.larger * 2 - color: Colours.palette[`term${index}`] - radius: Appearance.rounding.small - } - } - } - } - - component WrappedLoader: Loader { - asynchronous: true - visible: active - } - - component OsLogo: ColouredIcon { - source: SysInfo.osLogo - implicitSize: height - colour: Colours.palette.m3primary - layer.enabled: Config.lock.recolourLogo || SysInfo.isDefaultLogo - } - - component FetchText: MonoText { - Layout.fillWidth: true - font.pointSize: root.width > 400 ? Appearance.font.size.larger : Appearance.font.size.normal - elide: Text.ElideRight - } - - component MonoText: StyledText { - font.family: Appearance.font.family.mono - } -} 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/NotifDock.qml b/modules/lock/NotifDock.qml deleted file mode 100644 index 7551e68..0000000 --- a/modules/lock/NotifDock.qml +++ /dev/null @@ -1,146 +0,0 @@ -pragma ComponentBehavior: Bound - -import qs.components -import qs.components.containers -import qs.components.effects -import qs.services -import qs.config -import Quickshell -import Quickshell.Widgets -import QtQuick -import QtQuick.Layouts - -ColumnLayout { - id: root - - required property var lock - - anchors.fill: parent - anchors.margins: Appearance.padding.large - - spacing: Appearance.spacing.smaller - - StyledText { - Layout.fillWidth: true - text: Notifs.list.length > 0 ? qsTr("%1 notification%2").arg(Notifs.list.length).arg(Notifs.list.length === 1 ? "" : "s") : qsTr("Notifications") - color: Colours.palette.m3outline - font.family: Appearance.font.family.mono - font.weight: 500 - elide: Text.ElideRight - } - - ClippingRectangle { - id: clipRect - - Layout.fillWidth: true - Layout.fillHeight: true - - radius: Appearance.rounding.small - color: "transparent" - - Loader { - anchors.centerIn: parent - asynchronous: true - active: opacity > 0 - opacity: Notifs.list.length > 0 ? 0 : 1 - - sourceComponent: ColumnLayout { - spacing: Appearance.spacing.large - - Image { - asynchronous: true - source: Qt.resolvedUrl(`${Quickshell.shellDir}/assets/dino.png`) - fillMode: Image.PreserveAspectFit - sourceSize.width: clipRect.width * 0.8 - - layer.enabled: true - layer.effect: Colouriser { - colorizationColor: Colours.palette.m3outlineVariant - brightness: 1 - } - } - - StyledText { - Layout.alignment: Qt.AlignHCenter - text: qsTr("No Notifications") - color: Colours.palette.m3outlineVariant - font.pointSize: Appearance.font.size.large - font.family: Appearance.font.family.mono - font.weight: 500 - } - } - - Behavior on opacity { - Anim { - duration: Appearance.anim.durations.extraLarge - } - } - } - - StyledListView { - anchors.fill: parent - - spacing: Appearance.spacing.small - clip: true - - model: ScriptModel { - values: { - const list = Notifs.notClosed.map(n => [n.appName, null]); - return [...new Map(list).keys()]; - } - } - - delegate: NotifGroup {} - - add: Transition { - Anim { - property: "opacity" - from: 0 - to: 1 - } - Anim { - property: "scale" - from: 0 - to: 1 - duration: Appearance.anim.durations.expressiveDefaultSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial - } - } - - remove: Transition { - Anim { - property: "opacity" - to: 0 - } - Anim { - property: "scale" - to: 0.6 - } - } - - move: Transition { - Anim { - properties: "opacity,scale" - to: 1 - } - Anim { - property: "y" - duration: Appearance.anim.durations.expressiveDefaultSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial - } - } - - displaced: Transition { - Anim { - properties: "opacity,scale" - to: 1 - } - Anim { - property: "y" - duration: Appearance.anim.durations.expressiveDefaultSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial - } - } - } - } -} diff --git a/modules/lock/NotifGroup.qml b/modules/lock/NotifGroup.qml deleted file mode 100644 index 2a08c26..0000000 --- a/modules/lock/NotifGroup.qml +++ /dev/null @@ -1,319 +0,0 @@ -pragma ComponentBehavior: Bound - -import qs.components -import qs.components.effects -import qs.services -import qs.config -import qs.utils -import Quickshell -import Quickshell.Widgets -import Quickshell.Services.Notifications -import QtQuick -import QtQuick.Layouts - -StyledRect { - id: root - - required property string modelData - - readonly property list<var> notifs: Notifs.list.filter(notif => notif.appName === modelData) - readonly property string image: notifs.find(n => n.image.length > 0)?.image ?? "" - readonly property string appIcon: notifs.find(n => n.appIcon.length > 0)?.appIcon ?? "" - readonly property string urgency: notifs.some(n => n.urgency === NotificationUrgency.Critical) ? "critical" : notifs.some(n => n.urgency === NotificationUrgency.Normal) ? "normal" : "low" - - property bool expanded - - anchors.left: parent?.left - anchors.right: parent?.right - implicitHeight: content.implicitHeight + Appearance.padding.normal * 2 - - clip: true - radius: Appearance.rounding.normal - color: root.urgency === "critical" ? Colours.palette.m3secondaryContainer : Colours.layer(Colours.palette.m3surfaceContainerHigh, 2) - - RowLayout { - id: content - - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - anchors.margins: Appearance.padding.normal - - spacing: Appearance.spacing.normal - - Item { - Layout.alignment: Qt.AlignLeft | Qt.AlignTop - implicitWidth: Config.notifs.sizes.image - implicitHeight: Config.notifs.sizes.image - - Component { - id: imageComp - - Image { - source: Qt.resolvedUrl(root.image) - fillMode: Image.PreserveAspectCrop - cache: false - asynchronous: true - width: Config.notifs.sizes.image - height: Config.notifs.sizes.image - } - } - - Component { - id: appIconComp - - ColouredIcon { - implicitSize: Math.round(Config.notifs.sizes.image * 0.6) - source: Quickshell.iconPath(root.appIcon) - colour: root.urgency === "critical" ? Colours.palette.m3onError : root.urgency === "low" ? Colours.palette.m3onSurface : Colours.palette.m3onSecondaryContainer - layer.enabled: root.appIcon.endsWith("symbolic") - } - } - - Component { - id: materialIconComp - - MaterialIcon { - text: Icons.getNotifIcon(root.notifs[0]?.summary, root.urgency) - color: root.urgency === "critical" ? Colours.palette.m3onError : root.urgency === "low" ? Colours.palette.m3onSurface : Colours.palette.m3onSecondaryContainer - font.pointSize: Appearance.font.size.large - } - } - - ClippingRectangle { - anchors.fill: parent - color: root.urgency === "critical" ? Colours.palette.m3error : root.urgency === "low" ? Colours.layer(Colours.palette.m3surfaceContainerHighest, 3) : Colours.palette.m3secondaryContainer - radius: Appearance.rounding.full - - Loader { - anchors.centerIn: parent - asynchronous: true - sourceComponent: root.image ? imageComp : root.appIcon ? appIconComp : materialIconComp - } - } - - Loader { - anchors.right: parent.right - anchors.bottom: parent.bottom - asynchronous: true - active: root.appIcon && root.image - - sourceComponent: StyledRect { - implicitWidth: Config.notifs.sizes.badge - implicitHeight: Config.notifs.sizes.badge - - color: root.urgency === "critical" ? Colours.palette.m3error : root.urgency === "low" ? Colours.palette.m3surfaceContainerHighest : Colours.palette.m3secondaryContainer - radius: Appearance.rounding.full - - ColouredIcon { - anchors.centerIn: parent - implicitSize: Math.round(Config.notifs.sizes.badge * 0.6) - source: Quickshell.iconPath(root.appIcon) - colour: root.urgency === "critical" ? Colours.palette.m3onError : root.urgency === "low" ? Colours.palette.m3onSurface : Colours.palette.m3onSecondaryContainer - layer.enabled: root.appIcon.endsWith("symbolic") - } - } - } - } - - ColumnLayout { - Layout.topMargin: -Appearance.padding.small - Layout.bottomMargin: -Appearance.padding.small / 2 - (root.expanded ? 0 : spacing) - Layout.fillWidth: true - spacing: Math.round(Appearance.spacing.small / 2) - - RowLayout { - Layout.bottomMargin: -parent.spacing - Layout.fillWidth: true - spacing: Appearance.spacing.smaller - - StyledText { - Layout.fillWidth: true - text: root.modelData - color: Colours.palette.m3onSurfaceVariant - font.pointSize: Appearance.font.size.small - elide: Text.ElideRight - } - - StyledText { - animate: true - text: root.notifs[0]?.timeStr ?? "" - color: Colours.palette.m3outline - font.pointSize: Appearance.font.size.small - } - - StyledRect { - implicitWidth: expandBtn.implicitWidth + Appearance.padding.smaller * 2 - implicitHeight: groupCount.implicitHeight + Appearance.padding.small - - color: root.urgency === "critical" ? Colours.palette.m3error : Colours.layer(Colours.palette.m3surfaceContainerHighest, 2) - radius: Appearance.rounding.full - - opacity: root.notifs.length > Config.notifs.groupPreviewNum ? 1 : 0 - Layout.preferredWidth: root.notifs.length > Config.notifs.groupPreviewNum ? implicitWidth : 0 - - StateLayer { - color: root.urgency === "critical" ? Colours.palette.m3onError : Colours.palette.m3onSurface - - function onClicked(): void { - root.expanded = !root.expanded; - } - } - - RowLayout { - id: expandBtn - - anchors.centerIn: parent - spacing: Appearance.spacing.small / 2 - - StyledText { - id: groupCount - - Layout.leftMargin: Appearance.padding.small / 2 - animate: true - text: root.notifs.length - color: root.urgency === "critical" ? Colours.palette.m3onError : Colours.palette.m3onSurface - font.pointSize: Appearance.font.size.small - } - - MaterialIcon { - Layout.rightMargin: -Appearance.padding.small / 2 - animate: true - text: root.expanded ? "expand_less" : "expand_more" - color: root.urgency === "critical" ? Colours.palette.m3onError : Colours.palette.m3onSurface - } - } - - Behavior on opacity { - Anim {} - } - - Behavior on Layout.preferredWidth { - Anim {} - } - } - } - - Repeater { - model: ScriptModel { - values: root.notifs.slice(0, Config.notifs.groupPreviewNum) - } - - NotifLine { - id: notif - - ParallelAnimation { - running: true - - Anim { - target: notif - property: "opacity" - from: 0 - to: 1 - } - Anim { - target: notif - property: "scale" - from: 0.7 - to: 1 - } - Anim { - target: notif.Layout - property: "preferredHeight" - from: 0 - to: notif.implicitHeight - } - } - - ParallelAnimation { - running: notif.modelData.closed - onFinished: notif.modelData.unlock(notif) - - Anim { - target: notif - property: "opacity" - to: 0 - } - Anim { - target: notif - property: "scale" - to: 0.7 - } - Anim { - target: notif.Layout - property: "preferredHeight" - to: 0 - } - } - } - } - - Loader { - Layout.fillWidth: true - - opacity: root.expanded ? 1 : 0 - Layout.preferredHeight: root.expanded ? implicitHeight : 0 - active: opacity > 0 - asynchronous: true - - sourceComponent: ColumnLayout { - Repeater { - model: ScriptModel { - values: root.notifs.slice(Config.notifs.groupPreviewNum) - } - - NotifLine {} - } - } - - Behavior on opacity { - Anim {} - } - } - } - } - - Behavior on implicitHeight { - Anim { - duration: Appearance.anim.durations.expressiveDefaultSpatial - easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial - } - } - - component NotifLine: StyledText { - id: notifLine - - required property Notifs.Notif modelData - - Layout.fillWidth: true - textFormat: Text.MarkdownText - text: { - const summary = modelData.summary.replace(/\n/g, " "); - const body = modelData.body.replace(/\n/g, " "); - const colour = root.urgency === "critical" ? Colours.palette.m3secondary : Colours.palette.m3outline; - - if (metrics.text === metrics.elidedText) - return `${summary} <span style='color:${colour}'>${body}</span>`; - - const t = metrics.elidedText.length - 3; - if (t < summary.length) - return `${summary.slice(0, t)}...`; - - return `${summary} <span style='color:${colour}'>${body.slice(0, t - summary.length)}...</span>`; - } - color: root.urgency === "critical" ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface - - Component.onCompleted: modelData.lock(this) - Component.onDestruction: modelData.unlock(this) - - TextMetrics { - id: metrics - - text: `${notifLine.modelData.summary} ${notifLine.modelData.body}`.replace(/\n/g, " ") - font.pointSize: notifLine.font.pointSize - font.family: notifLine.font.family - elideWidth: notifLine.width - elide: Text.ElideRight - } - } -} 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 - } - } - } -} diff --git a/modules/lock/WeatherInfo.qml b/modules/lock/WeatherInfo.qml deleted file mode 100644 index b2b4579..0000000 --- a/modules/lock/WeatherInfo.qml +++ /dev/null @@ -1,179 +0,0 @@ -pragma ComponentBehavior: Bound - -import qs.components -import qs.services -import qs.config -import qs.utils -import QtQuick -import QtQuick.Layouts - -ColumnLayout { - id: root - - required property int rootHeight - - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: Appearance.padding.large * 2 - - spacing: Appearance.spacing.small - - Loader { - Layout.topMargin: Appearance.padding.large * 2 - Layout.bottomMargin: -Appearance.padding.large - Layout.alignment: Qt.AlignHCenter - - asynchronous: true - active: root.rootHeight > 610 - visible: active - - sourceComponent: StyledText { - text: qsTr("Weather") - color: Colours.palette.m3primary - font.pointSize: Appearance.font.size.extraLarge - font.weight: 500 - } - } - - RowLayout { - Layout.fillWidth: true - spacing: Appearance.spacing.large - - MaterialIcon { - animate: true - text: Weather.icon - color: Colours.palette.m3secondary - font.pointSize: Appearance.font.size.extraLarge * 2.5 - } - - ColumnLayout { - spacing: Appearance.spacing.small - - StyledText { - Layout.fillWidth: true - - animate: true - text: Weather.description - color: Colours.palette.m3secondary - font.pointSize: Appearance.font.size.large - font.weight: 500 - elide: Text.ElideRight - } - - StyledText { - Layout.fillWidth: true - - animate: true - text: qsTr("Humidity: %1%").arg(Weather.humidity) - color: Colours.palette.m3onSurfaceVariant - font.pointSize: Appearance.font.size.normal - elide: Text.ElideRight - } - } - - Loader { - Layout.rightMargin: Appearance.padding.smaller - asynchronous: true - active: root.width > 400 - visible: active - - sourceComponent: ColumnLayout { - spacing: Appearance.spacing.small - - StyledText { - Layout.fillWidth: true - - animate: true - text: Weather.temp - color: Colours.palette.m3primary - horizontalAlignment: Text.AlignRight - font.pointSize: Appearance.font.size.extraLarge - font.weight: 500 - elide: Text.ElideLeft - } - - StyledText { - Layout.fillWidth: true - - animate: true - text: qsTr("Feels like: %1").arg(Weather.feelsLike) - color: Colours.palette.m3outline - horizontalAlignment: Text.AlignRight - font.pointSize: Appearance.font.size.smaller - elide: Text.ElideLeft - } - } - } - } - - Loader { - id: forecastLoader - - Layout.topMargin: Appearance.spacing.smaller - Layout.bottomMargin: Appearance.padding.large * 2 - Layout.fillWidth: true - - asynchronous: true - active: root.rootHeight > 820 - visible: active - - sourceComponent: RowLayout { - spacing: Appearance.spacing.large - - Repeater { - model: { - const forecast = Weather.hourlyForecast; - const count = root.width < 320 ? 3 : root.width < 400 ? 4 : 5; - if (!forecast) - return Array.from({ - length: count - }, () => null); - - return forecast.slice(0, count); - } - - ColumnLayout { - id: forecastHour - - required property var modelData - - Layout.fillWidth: true - spacing: Appearance.spacing.small - - StyledText { - Layout.fillWidth: true - text: { - const hour = forecastHour.modelData?.hour ?? 0; - return hour > 12 ? `${(hour - 12).toString().padStart(2, "0")} PM` : `${hour.toString().padStart(2, "0")} AM`; - } - color: Colours.palette.m3outline - horizontalAlignment: Text.AlignHCenter - font.pointSize: Appearance.font.size.larger - } - - MaterialIcon { - Layout.alignment: Qt.AlignHCenter - text: forecastHour.modelData?.icon ?? "cloud_alert" - font.pointSize: Appearance.font.size.extraLarge * 1.5 - font.weight: 500 - } - - StyledText { - Layout.alignment: Qt.AlignHCenter - text: Config.services.useFahrenheit ? `${forecastHour.modelData?.tempF ?? 0}°F` : `${forecastHour.modelData?.tempC ?? 0}°C` - color: Colours.palette.m3secondary - font.pointSize: Appearance.font.size.larger - } - } - } - } - } - - Timer { - running: true - triggeredOnStart: true - repeat: true - interval: 900000 // 15 minutes - onTriggered: Weather.reload() - } -} |