add media and volume widget cards to lock screen
This commit is contained in:
parent
d495a63894
commit
b27c4a2abc
1 changed files with 68 additions and 0 deletions
|
|
@ -2,6 +2,8 @@ import QtQuick
|
||||||
import QtQuick.Effects
|
import QtQuick.Effects
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
|
import Quickshell.Services.Mpris
|
||||||
|
import Quickshell.Services.Pipewire
|
||||||
import "../modules" as M
|
import "../modules" as M
|
||||||
import "../modules/content" as C
|
import "../modules/content" as C
|
||||||
|
|
||||||
|
|
@ -153,6 +155,72 @@ WlSessionLockSurface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Spacer before widgets
|
||||||
|
Item {
|
||||||
|
width: 1
|
||||||
|
height: 8
|
||||||
|
visible: _mprisCard.visible || _volumeCard.visible
|
||||||
|
}
|
||||||
|
|
||||||
|
// Media widget
|
||||||
|
Rectangle {
|
||||||
|
id: _mprisCard
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
width: 280
|
||||||
|
height: _mprisContent.implicitHeight + 16
|
||||||
|
radius: M.Theme.radius + 2
|
||||||
|
color: Qt.rgba(M.Theme.base01.r, M.Theme.base01.g, M.Theme.base01.b, 0.7)
|
||||||
|
border.color: Qt.rgba(M.Theme.base03.r, M.Theme.base03.g, M.Theme.base03.b, 0.3)
|
||||||
|
border.width: 1
|
||||||
|
visible: _mprisPlayer !== null
|
||||||
|
|
||||||
|
readonly property var _mprisPlayers: (Mpris.players.values ?? []).filter(p => p.trackTitle || p.playbackState === MprisPlaybackState.Playing || p.playbackState === MprisPlaybackState.Paused)
|
||||||
|
readonly property var _mprisPlayer: _mprisPlayers[0] ?? null
|
||||||
|
readonly property bool _playing: _mprisPlayer?.playbackState === MprisPlaybackState.Playing
|
||||||
|
|
||||||
|
C.MprisContent {
|
||||||
|
id: _mprisContent
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: 8
|
||||||
|
player: _mprisCard._mprisPlayer
|
||||||
|
players: _mprisCard._mprisPlayers
|
||||||
|
playing: _mprisCard._playing
|
||||||
|
accentColor: M.Theme.base0D
|
||||||
|
cachedArt: _mprisCard._mprisPlayer?.trackArtUrl ?? ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Volume widget
|
||||||
|
Rectangle {
|
||||||
|
id: _volumeCard
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
width: 280
|
||||||
|
height: _volumeContent.implicitHeight + 16
|
||||||
|
radius: M.Theme.radius + 2
|
||||||
|
color: Qt.rgba(M.Theme.base01.r, M.Theme.base01.g, M.Theme.base01.b, 0.7)
|
||||||
|
border.color: Qt.rgba(M.Theme.base03.r, M.Theme.base03.g, M.Theme.base03.b, 0.3)
|
||||||
|
border.width: 1
|
||||||
|
visible: Pipewire.defaultAudioSink !== null
|
||||||
|
|
||||||
|
PwObjectTracker {
|
||||||
|
objects: [Pipewire.defaultAudioSink]
|
||||||
|
}
|
||||||
|
|
||||||
|
C.VolumeContent {
|
||||||
|
id: _volumeContent
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: 8
|
||||||
|
sink: Pipewire.defaultAudioSink
|
||||||
|
sinkList: []
|
||||||
|
streamList: []
|
||||||
|
accentColor: M.Theme.base0E
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue