Skip to content

Commit

Permalink
renderer: mpris: send Volume on initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
rocka committed Mar 23, 2022
1 parent 0084bf2 commit bfa7021
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/renderer/util/mpris.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ function subscribeHandler(mutation, state) {
case SET_AUDIO_PAUSED:
ipcSend(mutation.payload === true ? 'pause' : 'play');
break;
// since mpris is injected after Vue instance creation, it may not be
// able to receive `RESTORE_UI_STATE` mutation. keep it here anyway.
case RESTORE_UI_STATE:
ipcSend('volume', mutation.payload.audioVolume);
break;
Expand All @@ -135,6 +137,8 @@ function subscribeHandler(mutation, state) {
export function injectStore(store) {
// ensure 'PlaybackStatus' is 'Stopped' when this module loads
ipcSend('stop');
// send volume once on inject
ipcSend('volume', store.state.ui.audioVolume);
store.subscribe(subscribeHandler);
MPRISEmitter.on('play', () => store.dispatch('playAudio'));
MPRISEmitter.on('stop', () => store.dispatch('pauseAudio'));
Expand Down

0 comments on commit bfa7021

Please sign in to comment.