From 3ecc2e2e08e4524f5f6a9e40e9ea35fa346c79a4 Mon Sep 17 00:00:00 2001 From: Aylur Date: Mon, 25 Dec 2023 00:30:29 +0100 Subject: [PATCH] fix example bar --- example/simple-bar/config.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/example/simple-bar/config.js b/example/simple-bar/config.js index c38b2636..72b404d2 100644 --- a/example/simple-bar/config.js +++ b/example/simple-bar/config.js @@ -61,15 +61,14 @@ const Media = () => Widget.Button({ on_primary_click: () => Mpris.getPlayer('')?.playPause(), on_scroll_up: () => Mpris.getPlayer('')?.next(), on_scroll_down: () => Mpris.getPlayer('')?.previous(), - child: Widget.Label({ - label: Mpris.bind('players').transform(players => { - if (players[0]) { - const { track_artists, track_title } = players[0]; - return `${track_artists.join(', ')} - ${track_title}`; - } - return 'Nothing is playing'; - }), - }), + child: Widget.Label('-').hook(Mpris, self => { + if (Mpris.players[0]) { + const { track_artists, track_title } = Mpris.players[0]; + self.label = `${track_artists.join(', ')} - ${track_title}`; + } else { + self.label = 'Nothing is playing'; + } + }, 'player-changed'), }); const Volume = () => Widget.Box({