mirror of
https://github.com/belsabbagh/dotfiles.git
synced 2026-04-11 17:47:09 +00:00
128 lines
2.9 KiB
QML
128 lines
2.9 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import Quickshell
|
|
import Quickshell.Widgets
|
|
import Quickshell.Io
|
|
|
|
import qs.config
|
|
import qs.modules.functions
|
|
import qs.modules.components
|
|
import qs.services
|
|
|
|
Item {
|
|
id: mediaPlayer
|
|
|
|
property bool isVertical: (
|
|
ConfigResolver.bar(screen?.name ?? "").position === "left" ||
|
|
ConfigResolver.bar(screen?.name ?? "").position === "right"
|
|
)
|
|
|
|
Layout.alignment: Qt.AlignCenter | Qt.AlignVCenter
|
|
|
|
implicitWidth: bgRect.implicitWidth
|
|
implicitHeight: bgRect.implicitHeight
|
|
|
|
|
|
Rectangle {
|
|
id: bgRect
|
|
|
|
color: Appearance.m3colors.m3paddingContainer
|
|
radius: ConfigResolver.bar(screen?.name ?? "").modules.radius *
|
|
Config.runtime.appearance.rounding.factor
|
|
|
|
implicitWidth: isVertical
|
|
? row.implicitWidth + Metrics.margin("large") - 10
|
|
: row.implicitWidth + Metrics.margin("large")
|
|
|
|
implicitHeight: ConfigResolver.bar(screen?.name ?? "").modules.height
|
|
}
|
|
|
|
|
|
Row {
|
|
id: row
|
|
|
|
anchors.centerIn: parent
|
|
spacing: Metrics.margin("small")
|
|
|
|
|
|
ClippingRectangle {
|
|
id: iconButton
|
|
|
|
width: 24
|
|
height: 24
|
|
radius: ConfigResolver.bar(screen?.name ?? "").modules.radius / 1.2
|
|
|
|
color: Appearance.colors.colLayer1Hover
|
|
opacity: 0.9
|
|
|
|
clip: true
|
|
layer.enabled: true
|
|
|
|
|
|
Item {
|
|
anchors.fill: parent
|
|
|
|
|
|
Image {
|
|
id: art
|
|
|
|
anchors.fill: parent
|
|
visible: Mpris.artUrl !== ""
|
|
|
|
source: Mpris.artUrl
|
|
fillMode: Image.PreserveAspectCrop
|
|
smooth: true
|
|
mipmap: true
|
|
}
|
|
|
|
|
|
MaterialSymbol {
|
|
anchors.centerIn: parent
|
|
|
|
visible: Mpris.artUrl === ""
|
|
icon: "music_note"
|
|
|
|
iconSize: 18
|
|
color: Config.runtime.appearance.theme === "dark"
|
|
? "#b1a4a4"
|
|
: "grey"
|
|
}
|
|
}
|
|
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
|
|
onClicked: Mpris.playPause()
|
|
|
|
onEntered: iconButton.opacity = 1
|
|
onExited: iconButton.opacity = 0.9
|
|
}
|
|
|
|
|
|
RotationAnimation on rotation {
|
|
from: 0
|
|
to: 360
|
|
|
|
duration: Metrics.chronoDuration(4000)
|
|
loops: Animation.Infinite
|
|
|
|
running: Mpris.isPlaying &&
|
|
Config.runtime.appearance.animations.enabled
|
|
}
|
|
}
|
|
|
|
|
|
StyledText {
|
|
id: textItem
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
text: StringUtils.shortText(Mpris.title, 16)
|
|
|
|
visible: !mediaPlayer.isVertical
|
|
}
|
|
}
|
|
}
|