From ce5f49a9324bceccab821c1d2ebf3f72bdfc09ea Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Fri, 11 Jul 2025 22:06:08 +0800 Subject: mpris icon --- bar/Mpris.qml | 3 ++- config/Icons.qml | 40 +++++++++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/bar/Mpris.qml b/bar/Mpris.qml index 5ebcb74..87bef93 100644 --- a/bar/Mpris.qml +++ b/bar/Mpris.qml @@ -3,6 +3,7 @@ import QtQuick import Quickshell import Quickshell.Services.Mpris import qs.services +import qs.config // import Quickshell.Utils @@ -15,7 +16,7 @@ Item { readonly property string position: friendlyTimeForSeconds(activePlayer?.position) || "0:00" readonly property string length: friendlyTimeForSeconds(activePlayer?.length) || "0:00" readonly property string progress: activePlayer.positionSupported && position != length ? position + "/" + length : activePlayer.positionSupported && !activePlayer.lengthSupported ? !activePlayer.positionSupported && activePlayer.lengthSupported ? "" : position : activePlayer.lengthSupported ? length : "" - readonly property string state: activePlayer?.isPlaying ? "Playing" : "Paused" + readonly property string state: activePlayer?.isPlaying ? Icons.media.pause : Icons.media.play function cleanMusicTitle(title: string): string { if (!title) diff --git a/config/Icons.qml b/config/Icons.qml index df9636e..ec52e80 100644 --- a/config/Icons.qml +++ b/config/Icons.qml @@ -3,20 +3,30 @@ pragma Singleton import Quickshell Singleton { - id: root + id: root - readonly property var ws: ({ - 1: "", - 2: "", - 3: "", - 4: "", - 5: "", - 6: "", - 7: "", - 8: "", - 9: "", - urgent: "", - active: "", - default: " ", - }) + readonly property var ws: ({ + 1: "", + 2: "", + 3: "", + 4: "", + 5: "", + 6: "", + 7: "", + 8: "", + 9: "", + urgent: "", + active: "", + default: " " + }) + + readonly property var media: ({ + play: "", + pause: "", + stop: "", + // next: "", + // prev: "", + mute: "", + unmute: "" + }) } -- cgit v1.2.3