mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-19 14:12:07 +00:00
Support MPRIS loop
This commit is contained in:
@ -22,6 +22,7 @@ module.exports = () => {
|
||||
if (config.plugins.isEnabled('tuna-obs') ||
|
||||
(is.linux() && config.plugins.isEnabled('shortcuts'))) {
|
||||
setupTimeChangeListener();
|
||||
setupRepeatChangeListener();
|
||||
}
|
||||
const video = $('video');
|
||||
// name = "dataloaded" and abit later "dataupdated"
|
||||
@ -63,3 +64,13 @@ function setupTimeChangeListener() {
|
||||
});
|
||||
progressObserver.observe($('#progress-bar'), { attributeFilter: ["value"] })
|
||||
}
|
||||
|
||||
function setupRepeatChangeListener() {
|
||||
const repeatObserver = new MutationObserver(mutations => {
|
||||
ipcRenderer.send('repeatChanged', mutations[0].target.title);
|
||||
});
|
||||
repeatObserver.observe($('#right-controls .repeat'), { attributeFilter: ["title"] });
|
||||
|
||||
// Emit the initial value as well; as it's persistent between launches.
|
||||
ipcRenderer.send('repeatChanged', $('#right-controls .repeat').title);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user