summaryrefslogtreecommitdiff
path: root/services/Players.qml
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-08-23 21:34:31 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-08-23 21:34:31 +1000
commit0d9ab6ae499cdc7b6c2f7cd8df4ccfbb6be14999 (patch)
treefbdd938540e63256ffcb2dc281a051069d660c77 /services/Players.qml
parentservices: fix proc lang (#454) (diff)
downloadcaelestia-shell-0d9ab6ae499cdc7b6c2f7cd8df4ccfbb6be14999.tar.gz
caelestia-shell-0d9ab6ae499cdc7b6c2f7cd8df4ccfbb6be14999.tar.bz2
caelestia-shell-0d9ab6ae499cdc7b6c2f7cd8df4ccfbb6be14999.zip
config: player aliases + config default player
Closes #441
Diffstat (limited to 'services/Players.qml')
-rw-r--r--services/Players.qml10
1 files changed, 8 insertions, 2 deletions
diff --git a/services/Players.qml b/services/Players.qml
index 9c197f1..27249af 100644
--- a/services/Players.qml
+++ b/services/Players.qml
@@ -1,6 +1,7 @@
pragma Singleton
import qs.components.misc
+import qs.config
import Quickshell
import Quickshell.Io
import Quickshell.Services.Mpris
@@ -9,9 +10,14 @@ Singleton {
id: root
readonly property list<MprisPlayer> list: Mpris.players.values
- readonly property MprisPlayer active: manualActive ?? list.find(p => p.identity === "Spotify") ?? list[0] ?? null
+ readonly property MprisPlayer active: manualActive ?? list.find(p => getIdentity(p) === Config.services.defaultPlayer) ?? list[0] ?? null
property MprisPlayer manualActive
+ function getIdentity(player: MprisPlayer): string {
+ const alias = Config.services.playerAliases.find(a => a.from === player.identity);
+ return alias?.to ?? player.identity;
+ }
+
CustomShortcut {
name: "mediaToggle"
description: "Toggle media playback"
@@ -57,7 +63,7 @@ Singleton {
}
function list(): string {
- return root.list.map(p => p.identity).join("\n");
+ return root.list.map(p => root.getIdentity(p)).join("\n");
}
function play(): void {