Files
monoshell/Widgets/Time.qml
T

50 lines
1.4 KiB
QML

import QtQuick
import Quickshell
import Quickshell.Widgets
import Quickshell.Services.Mpris
Item {
id: time
property var player: Mpris.players.values[0]
anchors {
top: parent.top
bottom: parent.bottom
}
width: children[1].width + 18
Rectangle {
anchors.fill: parent
anchors.margins: 4
radius: 8
bottomRightRadius: 12
color: hover.hovered ? "#11ffffff" : "#00ffffff"
Behavior on color {ColorAnimation {duration: 150}}
}
Row {
spacing: 8
anchors.verticalCenter: parent.verticalCenter
x: 8
ClippingRectangle {
visible: !!time.player
anchors.verticalCenter: parent.verticalCenter
width: 24
height: width
radius: 6
Image {
anchors.fill: parent
source: time.player?.trackArtUrl ?? source
}
opacity: time.player?.isPlaying ? 1 : 0.5
Behavior on opacity {NumberAnimation {duration: 150}}
}
Text {
anchors.verticalCenter: parent.verticalCenter
property var clock: SystemClock {}
color: "white"
text: Qt.formatDateTime(clock.date, "ddd MMM dd · hh:mm")
font.family: root.font
}
}
HoverHandler {id: hover}
TapHandler {onTapped: background.index = 3}
}