From 2295f26618c6331b7219b53399ba090d8a76d050 Mon Sep 17 00:00:00 2001 From: Nydragon Date: Sat, 28 Sep 2024 19:13:36 +0200 Subject: [PATCH] chore: random fixes --- src/provider/Player.qml | 6 ++++-- src/widgets/MprisBig/MprisWidget.qml | 4 +++- src/windows/audioman/AudioManager.qml | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/provider/Player.qml b/src/provider/Player.qml index 204e074..89a1b64 100644 --- a/src/provider/Player.qml +++ b/src/provider/Player.qml @@ -8,8 +8,10 @@ Singleton { id: player property MprisPlayer current: player.all[player.index] property var all: Mpris.players.values - property int index: Mpris.players.values.findIndex(p => p.playbackState === MprisPlaybackState.Playing) - + property int index: { + const ind = Mpris.players.values.findIndex(p => p.playbackState === MprisPlaybackState.Playing); + return ind >= 0 ? ind : 0; + } property var next: () => { player.index = (player.index + 1) % all.length; } diff --git a/src/widgets/MprisBig/MprisWidget.qml b/src/widgets/MprisBig/MprisWidget.qml index 21490e8..2f64aa4 100644 --- a/src/widgets/MprisBig/MprisWidget.qml +++ b/src/widgets/MprisBig/MprisWidget.qml @@ -67,17 +67,19 @@ ColumnLayout { Layout.alignment: Qt.AlignHCenter BIconButton { + id: loopButton 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]) + source: visible ? Quickshell.iconPath(map[index][0]) : "" onClicked: { const ind = (index + 1) % map.length; Player.current.loopState = map[ind][1]; } + visible: 0 <= loopButton.index <= (map.length - 1) } BIconButton { source: Quickshell.iconPath("media-seek-backward") diff --git a/src/windows/audioman/AudioManager.qml b/src/windows/audioman/AudioManager.qml index 78542f4..9a69ff0 100644 --- a/src/windows/audioman/AudioManager.qml +++ b/src/windows/audioman/AudioManager.qml @@ -29,7 +29,7 @@ PopupWindow { id: display x: lbar.width * 1.2 - y: lbar.height * 0.2 + y: lbar.width * 0.2 width: 500 height: 600