Comments (9)
Thank you for the implementation.
Version: 1.3.1
- For Windows, when the tray is on, please change
close
button behaviour of window fromquit
tohide
. - In the tray,
play/pause
is not working properly.
from youtube-music.
Is it possible to add auto start when you turn on the computer?
from youtube-music.
Hey @benji009, thank you for the feedback!
#32 adds an option to autostart the application at login (YouTube Music then starts playing automatically) which is available in the 1.4.0 pre-release but only works for Mac/Win (limitation of electron), would this do the job for you?
from youtube-music.
yes that is perfect :)
from youtube-music.
The following codes will give you tray
const path = require('path');
const trayIcon = path.join(__dirname, 'assets/icon.ico');
//const trayIcon = nativeImage.createFromPath("./assets/icon.png");
app.on("ready", () => {
tray = new Tray(trayIcon)
const contextMenu = Menu.buildFromTemplate([
{
label: 'Play/Pause', click: function () {
hook_ytm("#left-controls > div > paper-icon-button.play-pause-button.style-scope.ytmusic-player-bar")
}
},
{
label: 'Next', click: function () {
hook_ytm("#left-controls > div > paper-icon-button.next-button.style-scope.ytmusic-player-bar")
}
},
{
label: 'Prev', click: function () {
hook_ytm("#left-controls > div > paper-icon-button.previous-button.style-scope.ytmusic-player-bar")
}
},
{
label: 'Show', click: function () {
win.show()
}
},
{
label: 'Quit', click: function () {
app.quit()
}
},
])
tray.setToolTip('Youtube Music')
tray.on('double-click', () => {
win.show()
})
if (process.platform == 'win32') {
tray.on('click', tray.popUpContextMenu)
}
tray.setContextMenu(contextMenu);
createWindow();
}
)
// bla bla bla
async function createWindow() {
win = new BrowserWindow({
backgroundColor: "#000",
webPreferences: { nodeIntegration: false, contextIsolation: true },
// bla bla bla
})
win.on('close', (event) => {
if (app.quitting) {
win = null
} else {
if (process.platform == 'darwin') {
app.dock.hide()
}
event.preventDefault()
win.hide()
}
})
await win.loadURL('https://music.youtube.com')
return win;
}
function hook_ytm(selector) {
win.webContents.executeJavaScript('document.querySelector("' + selector + '").click();', true)
}
from youtube-music.
Hey @fernandogobah , thanks for submitting the issue! The latest version (v1.3.1) has an "options" menu, you can enable tray and set the window visible or hidden - with "Tray + hidden window", you should have the behavior "start in tray".
Feel free to re-open this issue if it does not work properly!
PS: Thank you @subratappt for the code snippet, it has been implemented in the app!
from youtube-music.
Hey @subratappt, thanks for reporting both issues!
v1.3.2 should fix issue 1, the app should now not exit if the tray is on (unless you select "Quit" in the tray menu) + clicking on the tray icon should now show/hide the app.
For the second issue, play/pause
seems to work fine for me (tested on Windows/Mac) unless the plugin "autoconfirm when paused" is enabled (playing is resumed automatically by the plugin just after pausing), do yo have it enabled? This plugin is still quite experimental (it also messes up with play/pause through media keys) - if you don't have this plugin enabled, then it might be another bug! - which plugins do you use in the app?
from youtube-music.
Hey @subratappt, thanks for reporting both issues!
v1.3.2 should fix issue 1, the app should now not exit if the tray is on (unless you select "Quit" in the tray menu) + clicking on the tray icon should now show/hide the app.
For the second issue,
play/pause
seems to work fine for me (tested on Windows/Mac) unless the plugin "autoconfirm when paused" is enabled (playing is resumed automatically by the plugin just after pausing), do yo have it enabled? This plugin is still quite experimental (it also messes up with play/pause through media keys) - if you don't have this plugin enabled, then it might be another bug! - which plugins do you use in the app?
Thank you for the update. Yes for the second issue, "autoconfirm when paused" was enabled. I hope you will get the issue solved soon.
from youtube-music.
It seems the last open problem in this issue is the auto-confirm-when-paused vs media keys - it seems it is fixed in the last versions but in case it's not, it will be tracked in #129 - closing this one, feel free to re-open/open a new issue if needed!
from youtube-music.
Related Issues (20)
- [Enhancement]: Album color theme - thanks to some themes Sign in info isnt very visible HOT 2
- Visualiser memory leak HOT 1
- [Bug]: MPRIS may give incorrect `Position` HOT 1
- [Bug]: scrollbar of music type not shown HOT 4
- [Bug]: `Album colour theme` plugin bug HOT 3
- [Bug]: Incorrect interface import in Menu.ts
- [Bug]: Non functional menu icon appearing on macos HOT 3
- [Feature Request]: No duplication of menu bar HOT 1
- [Bug]: Music Together load indefinitely neither succedding nor failing until the host closes the session HOT 4
- [Bug]: Login / Sign in, can't login and dosen't stay logged in HOT 3
- [Bug]: MPRIS doesn't work correctly HOT 2
- [Bug]: last.fm scrobbler settings migration failure HOT 3
- [Bug]: Something is still wrong with initial play/pause state HOT 1
- [Bug]: Doubled window decoration HOT 1
- [Bug]: Navigation buttons (back/forward) are disabled HOT 3
- [Bug]: Video toggle Broken in all kinds of new ways because of new update (STILL NOT FIXED) HOT 9
- about HOT 2
- [Bug]: Video toggle Broken HOT 1
- [Bug]: `Crossfade` plugin is broken HOT 2
- [Feature Request]: Timebar more precise
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from youtube-music.