From b9215cdc9264d5f27c07d805fdce7c925d361787 Mon Sep 17 00:00:00 2001 From: Nydragon Date: Sat, 28 Sep 2024 02:32:52 +0200 Subject: [PATCH] feat: add shuffle and loop controls --- src/widgets/MprisBig/MprisWidget.qml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/widgets/MprisBig/MprisWidget.qml b/src/widgets/MprisBig/MprisWidget.qml index 118baea..5728a9d 100644 --- a/src/widgets/MprisBig/MprisWidget.qml +++ b/src/widgets/MprisBig/MprisWidget.qml @@ -6,6 +6,7 @@ import Quickshell.Widgets import "root:provider" import "root:base" import QtQuick.Effects +import Quickshell.Services.Mpris ColumnLayout { Layout.alignment: Qt.AlignHCenter @@ -57,19 +58,38 @@ ColumnLayout { } RowLayout { + // Mpris Player Controls Layout.alignment: Qt.AlignHCenter + BIconButton { + property var map: [ // + ["media-repeat-none", MprisLoopState.None] // + , ["media-repeat-single", MprisLoopState.Track]// + , ["media-playlist-repeat", MprisLoopState.Playlist] // + ] + property int index: map.findIndex(e => e[1] === Player.current?.loopState) + source: Quickshell.iconPath(map[index][0]) + onClicked: { + const ind = (index + 1) % map.length; + Player.current.loopState = map[ind][1]; + } + } BIconButton { source: Quickshell.iconPath("media-seek-backward") onClicked: Player.current.previous() } BIconButton { - source: Quickshell.iconPath(Player.isPlaying ? "media-playback-start" : "media-playback-pause") + source: Quickshell.iconPath(Player.isPlaying ? "media-playback-pause" : "media-playback-start") onClicked: Player.current.togglePlaying() } BIconButton { source: Quickshell.iconPath("media-seek-forward") onClicked: Player.current.next() } + BIconButton { + visible: Player.current?.shuffleSupported ?? false + source: Quickshell.iconPath(Player.current?.shuffle ? "media-playlist-shuffle" : "media-playlist-normal") + onClicked: Player.current.shuffle = !Player.current?.shuffle + } } }