quickshell: source badge from xesam:url, vinyl fallback label
This commit is contained in:
parent
8dbdb42841
commit
02ebdc36ce
1 changed files with 56 additions and 11 deletions
|
|
@ -4094,13 +4094,50 @@ in
|
|||
radius: width / 2
|
||||
color: Theme.base02
|
||||
|
||||
// Art-less fallback: an actual record
|
||||
// rather than a flat placeholder, so
|
||||
// a source with no MediaSession
|
||||
// artwork (Jellyfin's web player, a
|
||||
// plain <video> tag) still reads as
|
||||
// deliberate. Grooves only turn
|
||||
// visibly because they're eccentric
|
||||
// to the disc — concentric rings
|
||||
// would look static while spinning.
|
||||
Item {
|
||||
id: blankLabel
|
||||
anchors.fill: parent
|
||||
visible: albumArt.status !== Image.Ready
|
||||
|
||||
Repeater {
|
||||
model: 3
|
||||
Rectangle {
|
||||
required property int index
|
||||
anchors.centerIn: parent
|
||||
anchors.horizontalCenterOffset: 1
|
||||
width: vinyl.discSize - 10 - index * 14
|
||||
height: width
|
||||
radius: width / 2
|
||||
color: "transparent"
|
||||
border.width: 1
|
||||
border.color: Theme.base03
|
||||
opacity: 0.5
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
width: 34; height: 34
|
||||
radius: 17
|
||||
color: Theme.base0C
|
||||
opacity: 0.25
|
||||
}
|
||||
SIcon {
|
||||
anchors.centerIn: parent
|
||||
visible: albumArt.status !== Image.Ready
|
||||
text: "music"
|
||||
color: Theme.base04
|
||||
font.pixelSize: 30
|
||||
text: sourceBadge.glyph !== "" ? sourceBadge.glyph : "music"
|
||||
color: Theme.base05
|
||||
font.pixelSize: 18
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: albumArt
|
||||
anchors.fill: parent
|
||||
|
|
@ -4132,16 +4169,24 @@ in
|
|||
border.color: Theme.base03
|
||||
}
|
||||
|
||||
// Source badge. MPRIS identity is the
|
||||
// browser, not the site, so YouTube is
|
||||
// inferred from the art host instead.
|
||||
// Source badge. MPRIS identity only ever
|
||||
// names the browser, so the site comes
|
||||
// from xesam:url in the raw metadata —
|
||||
// the one field that actually says where
|
||||
// the audio is from.
|
||||
Rectangle {
|
||||
id: sourceBadge
|
||||
readonly property string glyph: {
|
||||
let md = mediaCard.modelData.metadata || ({});
|
||||
let u = (md["xesam:url"] || "").toLowerCase();
|
||||
let ident = (mediaCard.modelData.identity || "").toLowerCase();
|
||||
let art = (mediaCard.modelData.trackArtUrl || "").toLowerCase();
|
||||
if (art.indexOf("ytimg") >= 0 || ident.indexOf("youtube") >= 0) return "youtube";
|
||||
if (ident.indexOf("mpv") >= 0 || ident.indexOf("vlc") >= 0) return "video";
|
||||
if (u.indexOf("youtube.com") >= 0 || u.indexOf("youtu.be") >= 0) return "youtube";
|
||||
if (u.indexOf("twitch.tv") >= 0) return "twitch";
|
||||
// Jellyfin: our own server, no
|
||||
// public hostname to match on.
|
||||
if (u.indexOf(":8096") >= 0 || u.indexOf("jellyfin") >= 0) return "clapperboard";
|
||||
if (ident.indexOf("mpv") >= 0 || ident.indexOf("vlc") >= 0) return "film";
|
||||
if (u.indexOf("file://") === 0) return "music";
|
||||
return "";
|
||||
}
|
||||
visible: sourceBadge.glyph !== ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue