mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 19:01:47 +00:00
fix(mpris): fixed an issue where MPRIS information was incorrect (#1291)
This commit is contained in:
4
plugins/shortcuts/mpris-service.d.ts
vendored
4
plugins/shortcuts/mpris-service.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
declare module 'mpris-service' {
|
||||
declare module '@jellybrick/mpris-service' {
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
import dbus from 'dbus-next';
|
||||
@ -75,6 +75,8 @@ declare module 'mpris-service' {
|
||||
|
||||
objectPath(subpath?: string): string;
|
||||
|
||||
getPosition(): number;
|
||||
|
||||
seeked(position: number): void;
|
||||
|
||||
getTrackIndex(trackId: string): number;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { BrowserWindow, ipcMain } from 'electron';
|
||||
|
||||
import mpris, { Track } from 'mpris-service';
|
||||
import mpris, { Track } from '@jellybrick/mpris-service';
|
||||
|
||||
import registerCallback from '../../providers/song-info';
|
||||
import getSongControls from '../../providers/song-controls';
|
||||
@ -50,18 +50,13 @@ function registerMPRIS(win: BrowserWindow) {
|
||||
player.loopStatus = mpris.LOOP_STATUS_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'ONE': {
|
||||
player.loopStatus = mpris.LOOP_STATUS_PLAYLIST;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'ALL': {
|
||||
{
|
||||
player.loopStatus = mpris.LOOP_STATUS_TRACK;
|
||||
// No default
|
||||
}
|
||||
|
||||
player.loopStatus = mpris.LOOP_STATUS_TRACK;
|
||||
// No default
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -76,6 +71,7 @@ function registerMPRIS(win: BrowserWindow) {
|
||||
const delta = (targetIndex - currentIndex + 3) % 3;
|
||||
songControls.switchRepeat(delta);
|
||||
});
|
||||
player.getPosition = () => secToMicro(currentSeconds);
|
||||
|
||||
player.on('raise', () => {
|
||||
win.setSkipTaskbar(false);
|
||||
@ -110,7 +106,7 @@ function registerMPRIS(win: BrowserWindow) {
|
||||
shuffle();
|
||||
}
|
||||
});
|
||||
player.on('open', (args: { uri: string}) => { win.loadURL(args.uri); });
|
||||
player.on('open', (args: { uri: string }) => { win.loadURL(args.uri); });
|
||||
|
||||
let mprisVolNewer = false;
|
||||
let autoUpdate = false;
|
||||
|
||||
Reference in New Issue
Block a user