From a85136aa2bc0bc1b75db728522ffaa000a5a488d Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Thu, 8 Feb 2024 00:53:35 +0700 Subject: [PATCH] music controls: fix synced controls for different instances (#243) --- .config/ags/widgets/indicators/musiccontrols.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.config/ags/widgets/indicators/musiccontrols.js b/.config/ags/widgets/indicators/musiccontrols.js index 9a2fff165..d13d312a6 100644 --- a/.config/ags/widgets/indicators/musiccontrols.js +++ b/.config/ags/widgets/indicators/musiccontrols.js @@ -198,7 +198,7 @@ const TrackControls = ({ player, ...rest }) => Widget.Revealer({ children: [ Button({ className: 'osd-music-controlbtn', - onClicked: () => execAsync('playerctl previous').catch(print), + onClicked: () => player.previous(), child: Label({ className: 'icon-material osd-music-controlbtn-txt', label: 'skip_previous', @@ -206,9 +206,7 @@ const TrackControls = ({ player, ...rest }) => Widget.Revealer({ }), Button({ className: 'osd-music-controlbtn', - onClicked: () => execAsync(['bash', '-c', 'playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"`']) - .catch(print) - , + onClicked: () => player.next(), child: Label({ className: 'icon-material osd-music-controlbtn-txt', label: 'skip_next', @@ -297,7 +295,7 @@ const PlayState = ({ player }) => { overlays: [ Widget.Button({ className: 'osd-music-playstate-btn', - onClicked: () => execAsync('playerctl play-pause').catch(print), + onClicked: () => player.playPause(), child: Widget.Label({ justification: 'center', hpack: 'fill',