summaryrefslogtreecommitdiff
path: root/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/MprisController.qml
diff options
context:
space:
mode:
authorAlexanderCurl <alexc@alexc.hu>2026-04-18 17:46:06 +0100
committerAlexanderCurl <alexc@alexc.hu>2026-04-18 17:46:06 +0100
commit70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69 (patch)
treeab1123d4067c1b086dd6faa7ee4ea643236b565a /raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/MprisController.qml
parent5d94c0a7d44a2255b81815a52a7056a94a39842d (diff)
downloadRaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.tar.gz
RaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.zip
Replaced file structures for themes in the correct format
Diffstat (limited to 'raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/MprisController.qml')
-rw-r--r--raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/MprisController.qml78
1 files changed, 0 insertions, 78 deletions
diff --git a/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/MprisController.qml b/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/MprisController.qml
deleted file mode 100644
index 44ad135..0000000
--- a/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/MprisController.qml
+++ /dev/null
@@ -1,78 +0,0 @@
-pragma Singleton
-pragma ComponentBehavior: Bound
-
-import QtQuick
-import Quickshell
-import Quickshell.Services.Mpris
-import qs.Common
-
-Singleton {
- id: root
-
- readonly property list<MprisPlayer> availablePlayers: Mpris.players.values
- property MprisPlayer activePlayer: null
-
- onAvailablePlayersChanged: _resolveActivePlayer()
- Component.onCompleted: _resolveActivePlayer()
-
- Instantiator {
- model: root.availablePlayers
- delegate: Connections {
- required property MprisPlayer modelData
- target: modelData
- function onIsPlayingChanged() {
- if (modelData.isPlaying)
- root._resolveActivePlayer();
- }
- }
- }
-
- function _resolveActivePlayer(): void {
- const playing = availablePlayers.find(p => p.isPlaying);
- if (playing) {
- activePlayer = playing;
- _persistIdentity(playing.identity);
- return;
- }
- if (activePlayer && availablePlayers.indexOf(activePlayer) >= 0)
- return;
- const savedId = SessionData.lastPlayerIdentity;
- if (savedId) {
- const match = availablePlayers.find(p => p.identity === savedId);
- if (match) {
- activePlayer = match;
- return;
- }
- }
- activePlayer = availablePlayers.find(p => p.canControl && p.canPlay) ?? null;
- if (activePlayer)
- _persistIdentity(activePlayer.identity);
- }
-
- function setActivePlayer(player: MprisPlayer): void {
- activePlayer = player;
- if (player)
- _persistIdentity(player.identity);
- }
-
- function _persistIdentity(identity: string): void {
- if (identity && SessionData.lastPlayerIdentity !== identity)
- SessionData.set("lastPlayerIdentity", identity);
- }
-
- Timer {
- interval: 1000
- running: root.activePlayer?.playbackState === MprisPlaybackState.Playing
- repeat: true
- onTriggered: root.activePlayer?.positionChanged()
- }
-
- function previousOrRewind(): void {
- if (!activePlayer)
- return;
- if (activePlayer.position > 8 && activePlayer.canSeek)
- activePlayer.position = 0;
- else if (activePlayer.canGoPrevious)
- activePlayer.previous();
- }
-}