players: persist active player across reloads
This commit is contained in:
parent
06f366e27e
commit
d79b5b7f71
1 changed files with 10 additions and 2 deletions
|
|
@ -10,14 +10,22 @@ Singleton {
|
|||
id: root
|
||||
|
||||
readonly property list<MprisPlayer> list: Mpris.players.values
|
||||
readonly property MprisPlayer active: manualActive ?? list.find(p => getIdentity(p) === Config.services.defaultPlayer) ?? list[0] ?? null
|
||||
property MprisPlayer manualActive
|
||||
readonly property MprisPlayer active: props.manualActive ?? list.find(p => getIdentity(p) === Config.services.defaultPlayer) ?? list[0] ?? null
|
||||
property alias manualActive: props.manualActive
|
||||
|
||||
function getIdentity(player: MprisPlayer): string {
|
||||
const alias = Config.services.playerAliases.find(a => a.from === player.identity);
|
||||
return alias?.to ?? player.identity;
|
||||
}
|
||||
|
||||
PersistentProperties {
|
||||
id: props
|
||||
|
||||
property MprisPlayer manualActive
|
||||
|
||||
reloadableId: "players"
|
||||
}
|
||||
|
||||
CustomShortcut {
|
||||
name: "mediaToggle"
|
||||
description: "Toggle media playback"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue