diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-08-11 01:38:37 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-08-11 01:38:37 +1000 |
| commit | dcaa49cddc1a075eb2825637b7681e61223ba45d (patch) | |
| tree | 9dd944cdb6da259c4bfabc80777ab526a4a2ecc3 /modules/lock/Media.qml | |
| parent | lock: better unlock anim (diff) | |
| download | caelestia-shell-dcaa49cddc1a075eb2825637b7681e61223ba45d.tar.gz caelestia-shell-dcaa49cddc1a075eb2825637b7681e61223ba45d.tar.bz2 caelestia-shell-dcaa49cddc1a075eb2825637b7681e61223ba45d.zip | |
lock: add media + some fixes
Diffstat (limited to 'modules/lock/Media.qml')
| -rw-r--r-- | modules/lock/Media.qml | 95 |
1 files changed, 95 insertions, 0 deletions
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 + } + } +} |