Files
glassMxrph/quickshell/notch/NotchMedia.qml
T
mxandClaude Opus 5.5 fc272e45b2 Open the equalizer from the notch's album art, and add notch view commands
Clicking the artwork on the notch's Media page swaps in the dashboard's
EasyEffects equalizer as a full view, the way Performance opens
"Your computer". `glassmxrph notch equalizer|computer` opens the notch
straight onto either view (or the matching dashboard tab with the full bar).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 00:52:59 +01:00

210 lines
7.6 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import Quickshell.Widgets
import "../components"
import "../core"
import "../dashboard"
import "../services"
import "../theme"
// The notch's Media page: large artwork, track, seek bar, transport and a
// Cava strip, sized to fill the left column. Clicking the artwork opens the
// equalizer view (when the dashboard's EasyEffects equalizer is on).
Item {
id: root
property bool active: false
// Streams report no length or absurd ones; show them as live.
readonly property bool live: MediaService.length <= 0 || MediaService.length > 7 * 86400
readonly property bool hasPlayer: !!MediaService.player
readonly property real artSize: Math.max(120, Math.min(width - 40, height - 250, 250))
readonly property bool equalizer: ConfigService.ready && !!ConfigService.data.dashboard && ConfigService.data.dashboard.easyEffects
Demand {
service: MediaService
counter: "progressConsumers"
active: root.active
}
Demand {
service: CavaService
counter: "widgetConsumers"
active: root.active
}
Column {
anchors.centerIn: parent
width: parent.width - 24
spacing: 14
ClippingRectangle {
anchors.horizontalCenter: parent.horizontalCenter
width: root.artSize
height: root.artSize
radius: 24
color: Theme.fill
border.width: 1
border.color: Theme.hairline
Text {
anchors.centerIn: parent
visible: art.status !== Image.Ready
text: Icons.available ? "󰝚" : "♪"
font.family: Icons.available ? Icons.family : ""
font.pixelSize: root.artSize * 0.32
color: Theme.textSecondary
}
Image {
id: art
anchors.fill: parent
source: MediaService.artwork
sourceSize: Qt.size(500, 500)
fillMode: Image.PreserveAspectCrop
asynchronous: true
retainWhileLoading: true
opacity: status === Image.Ready ? 1 : 0
Behavior on opacity {
NumberAnimation {
duration: Theme.notchDuration
}
}
}
// Hover hint for the equalizer.
Rectangle {
anchors.fill: parent
color: Qt.alpha("black", 0.45)
opacity: artArea.containsMouse ? 1 : 0
Behavior on opacity {
NumberAnimation {
duration: Theme.notchDuration / 2
}
}
Text {
anchors.centerIn: parent
text: "Equalizer"
color: "white"
font.pixelSize: 15
font.weight: Font.DemiBold
}
}
MouseArea {
id: artArea
objectName: "notchArtwork"
anchors.fill: parent
enabled: root.equalizer
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: ShellState.notchView = "equalizer"
Accessible.role: Accessible.Button
Accessible.name: "Equalizer"
}
}
Column {
width: parent.width
spacing: 3
Text {
width: parent.width
horizontalAlignment: Text.AlignHCenter
text: MediaService.title
color: Theme.text
font.pixelSize: 18
font.weight: Font.DemiBold
elide: Text.ElideRight
}
Text {
width: parent.width
horizontalAlignment: Text.AlignHCenter
text: MediaService.artist
color: Theme.textSecondary
font.pixelSize: 13
elide: Text.ElideRight
}
}
Column {
visible: root.hasPlayer
width: parent.width
GlassSlider {
objectName: "notchSeek"
width: parent.width
from: 0
to: root.live ? 1 : Math.max(1, MediaService.length)
value: root.live ? 0 : MediaService.position
enabled: MediaService.seekable && !root.live
opacity: root.live ? 0.4 : 1
onMoved: MediaService.seek(value)
}
Item {
width: parent.width
height: 14
Text {
text: root.live ? "" : MediaService.time(MediaService.position)
color: Theme.textSecondary
font.pixelSize: 11
font.features: {
"tnum": 1
}
}
Text {
anchors.right: parent.right
text: root.live ? "LIVE" : MediaService.time(MediaService.length)
color: Theme.textSecondary
font.pixelSize: 11
font.features: {
"tnum": 1
}
}
}
}
Row {
anchors.horizontalCenter: parent.horizontalCenter
spacing: 22
DashButton {
anchors.verticalCenter: parent.verticalCenter
objectName: "notchPrevious"
size: 44
glyph: "󰒮"
fallback: "⏮"
interactive: root.hasPlayer && MediaService.player.canControl && MediaService.player.canGoPrevious
onClicked: MediaService.previous()
Accessible.name: "Previous track"
}
DashButton {
anchors.verticalCenter: parent.verticalCenter
objectName: "notchToggle"
size: 60
accented: true
glyph: MediaService.playing ? "󰏤" : "󰐊"
fallback: MediaService.playing ? "⏸" : "▶"
interactive: root.hasPlayer && MediaService.player.canControl && MediaService.player.canTogglePlaying
onClicked: MediaService.toggle()
Accessible.name: MediaService.playing ? "Pause" : "Play"
}
DashButton {
anchors.verticalCenter: parent.verticalCenter
objectName: "notchNext"
size: 44
glyph: "󰒭"
fallback: "⏭"
interactive: root.hasPlayer && MediaService.player.canControl && MediaService.player.canGoNext
onClicked: MediaService.next()
Accessible.name: "Next track"
}
}
// Fixed-height wrapper keeps Cava frames from re-laying out the column.
Item {
width: parent.width
height: 30
Row {
anchors.fill: parent
spacing: 3
opacity: MediaService.playing ? 1 : 0.25
Repeater {
model: 24
Rectangle {
required property int index
anchors.bottom: parent.bottom
width: (root.width - 24 - 23 * 3) / 24
radius: 2
height: Math.max(3, 30 * (MediaService.playing ? (CavaService.bars[index] || 0) : 0.05))
color: Qt.alpha(Theme.accentVivid, 0.85)
}
}
}
}
}
}