move stuff into components
This commit is contained in:
parent
6370732e4e
commit
14292e6683
17 changed files with 81 additions and 149 deletions
|
|
@ -1,12 +1,20 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import Quickshell.Services.Mpris
|
||||
import "." as M
|
||||
|
||||
Row {
|
||||
M.BarSection {
|
||||
id: root
|
||||
spacing: 4
|
||||
visible: player !== null
|
||||
tooltip: {
|
||||
const p = root.player;
|
||||
if (!p) return "";
|
||||
const parts = [];
|
||||
if (p.trackTitle) parts.push(p.trackTitle);
|
||||
if (p.trackArtists?.length) parts.push(p.trackArtists.join(", "));
|
||||
if (p.trackAlbum) parts.push(p.trackAlbum);
|
||||
return parts.join("\n") || p.identity;
|
||||
}
|
||||
|
||||
readonly property MprisPlayer player: Mpris.players.values[0] ?? null
|
||||
readonly property bool playing: player?.playbackState === MprisPlaybackState.Playing
|
||||
|
|
@ -20,20 +28,6 @@ Row {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
HoverHandler { id: hover }
|
||||
ToolTip {
|
||||
visible: hover.hovered
|
||||
text: {
|
||||
const p = root.player;
|
||||
if (!p) return "";
|
||||
const parts = [];
|
||||
if (p.trackTitle) parts.push(p.trackTitle);
|
||||
if (p.trackArtists?.length) parts.push(p.trackArtists.join(", "));
|
||||
if (p.trackAlbum) parts.push(p.trackAlbum);
|
||||
return parts.join("\n") || p.identity;
|
||||
}
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
onTapped: root.player?.togglePlaying()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue