Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"productName": "YouTube Music",
"mac": {
"identity": null,
"files": ["!plugins/{taskbar-mediacontrol,notifications/snoretoast}${/*}"],
"target": [
{
"target": "dmg",
Expand All @@ -28,6 +29,7 @@
},
"win": {
"icon": "assets/generated/icons/win/icon.ico",
"files": ["!plugins/touchbar${/*}"],
"target": [
"nsis",
"portable"
Expand All @@ -38,6 +40,7 @@
},
"linux": {
"icon": "assets/generated/icons/png",
"files": ["!plugins/{touchbar,taskbar-mediacontrol,notifications/snoretoast}${/*}"],
"category": "AudioVideo",
"target": [
"AppImage",
Expand Down
4 changes: 1 addition & 3 deletions plugins/notifications/back.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ const is = require("electron-is");
const registerCallback = require("../../providers/song-info");
const { notificationImage } = require("./utils");

const setupInteractive = require("./interactive")

const notify = (info, options) => {

// Fill the notification with content
Expand Down Expand Up @@ -41,6 +39,6 @@ const setup = (options) => {
module.exports = (win, options) => {
// Register the callback for new song information
is.windows() && options.interactive ?
setupInteractive(win, options.unpauseNotification) :
require("./snoretoast/interactive")(win, options.unpauseNotification) :
setup(options);
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
const { notificationImage, icons } = require("./utils");
const getSongControls = require('../../providers/song-controls');
const registerCallback = require("../../providers/song-info");
const notifier = require("node-notifier");
const { notificationImage, icons } = require("../utils");
const getSongControls = require('../../../providers/song-controls');
const registerCallback = require("../../../providers/song-info");
const WindowsToaster = require('node-notifier').WindowsToaster;

const notifier = new WindowsToaster({
withFallback: true,
// see https://github.com/th-ch/youtube-music/pull/591
customPath: require("path").join(__dirname, 'snoretoast-x64.exe')
});

//store song controls reference on launch
let controls;
Expand All @@ -17,11 +23,11 @@ module.exports = (win, unpauseNotification) => {

// Register songInfoCallback
registerCallback(songInfo => {
if (!songInfo.isPaused && (songInfo.url !== currentUrl || notificationOnUnpause)) {
if (!songInfo.isPaused && (songInfo.url !== currentUrl || notificationOnUnpause)) {
currentUrl = songInfo.url;
sendToaster(songInfo);
}
});
}
});

win.webContents.once("closed", () => {
deleteNotification()
Expand All @@ -48,7 +54,7 @@ function sendToaster(songInfo) {
//download image and get path
let imgSrc = notificationImage(songInfo, true);
toDelete = {
//app id undefined - will break buttons
appID: "com.github.th-ch.youtube-music",
title: songInfo.title || "Playing",
message: songInfo.artist,
id: parseInt(Math.random() * 1000000, 10),
Expand Down
Binary file not shown.