From dcaa49cddc1a075eb2825637b7681e61223ba45d Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Mon, 11 Aug 2025 01:38:37 +1000 Subject: lock: add media + some fixes --- modules/lock/Media.qml | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 modules/lock/Media.qml (limited to 'modules/lock/Media.qml') diff --git a/modules/lock/Media.qml b/modules/lock/Media.qml new file mode 100644 index 0000000..055ed62 --- /dev/null +++ b/modules/lock/Media.qml @@ -0,0 +1,95 @@ +pragma ComponentBehavior: Bound + +import qs.components +import qs.services +import qs.config +import Quickshell +import QtQuick +import QtQuick.Layouts + +Item { + id: root + + anchors.left: parent.left + anchors.right: parent.right + implicitHeight: layout.implicitHeight + + Image { + anchors.fill: parent + source: Players.active?.trackArtUrl ?? null + + asynchronous: true + fillMode: Image.PreserveAspectCrop + sourceSize.width: width + sourceSize.height: height + + layer.enabled: true + layer.effect: ShaderEffect { + required property Item source + readonly property Item maskSource: mask + + fragmentShader: `file://${Quickshell.shellDir}/assets/shaders/opacitymask.frag.qsb` + } + } + + 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 + text: qsTr("Now playing") + color: Colours.palette.m3outline + } + + StyledText { + Layout.fillWidth: true + text: Players.active?.trackArtist ?? qsTr("No media") + color: Colours.palette.m3primary + horizontalAlignment: Text.AlignHCenter + font.pointSize: Appearance.font.size.large + font.weight: 500 + elide: Text.ElideRight + } + + StyledText { + Layout.fillWidth: true + text: Players.active?.trackTitle ?? qsTr("No media") + horizontalAlignment: Text.AlignHCenter + elide: Text.ElideRight + } + + RowLayout { + Layout.fillWidth: true + Layout.bottomMargin: Appearance.padding.large + } + } +} -- cgit v1.2.3-freya