Make it possible to associate supported file types with museeks
It should be possible to make museeks default app for supported file types
Related: #155
refs (last Atom version)
It looks like this may be unsupported? https://github.com/electron/electron/issues/2651
Atom does it. We might need to find how they managed to do that.
It's a bit dated, but is it possible to add a DDE server ( https://www.npmjs.com/package/electron-node-dde ), update the registry ( https://msdn.microsoft.com/en-us/library/windows/desktop/hh127429(v=vs.85).aspx ), verify that you have the single-instance option ( https://github.com/electron/electron/blob/master/docs/api/app.md#appmakesingleinstancecallback ) and then it might work like this natively.
An example setup would be in your registry already if you have, say, Excel: HKEY_CLASSES_ROOT\Excel.Sheet.8 (see shell\Print\ddeexec, for example)
Otherwise, you'd need the electron.exe program to see any (undecorated) command-line arguments passed to it and then expose them to you. I've just walked the process.argv[i] stack and zero is electron.exe (with path) and the next sixteen are mostly "--type=renderer" and a variety of things, ending with process.argv[16] as "/prefetch:1" and nothing more. If you attempt to run electron.exe from the command line with an argument it just doesn't make it to that argument stack. The same goes for right-mouse click launching an MP3 file from Explorer with an Open With => Electron (which should be the default). So it sounds like the native method of using arguments from the command line or Open With just won't work. Or will it...?
Eureka!
Okay, I added global.sharedObject = {prop1: process.argv} near the top of resources\app\src\main-process\main.js and added...
<script>
var remote = require('electron').remote, arguments = remote.getGlobal('sharedObject').prop1;
alert(arguments);
</script>
...just before the ending BODY tag in my app.html. I then open Explorer, right-mouse click an MP3, Open With..., select Electron and the alert indicates the list of arguments. The first is of course the program with path itself and the second (now) is the indicated music file.
Does that help at all? You'd need to force single-instance of course.
If you're only interested in the current user in Windows, it's:
CurrentUser_Add.reg:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.mp3\OpenWithList]
"a"="wmplayer.exe"
"MRUList"="ba"
"b"="electron.exe"
So basically, you'd have to add another entry (incrementing the letter for the key) for electron.exe in this case. I don't think technically you have to adjust the MRUList entry. And of course, you'd repeat this for other supported file types like .wav or whatever.
I would guess that it's there already, but you might also need at the global level:
ElectronApp_Add.reg:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Applications\electron.exe]
[HKEY_CLASSES_ROOT\Applications\electron.exe\shell]
[HKEY_CLASSES_ROOT\Applications\electron.exe\shell\open]
[HKEY_CLASSES_ROOT\Applications\electron.exe\shell\open\command]
@="\"D:\\sites\\mplayer\\mplayer-win32-x64\\electron.exe\" \"%1\""
Of course, that's my own filepath to the executable.
ElectronApp-CurrentUser_Add.reg:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\Applications\electron.exe]
[HKEY_CURRENT_USER\Software\Classes\Applications\electron.exe\shell]
[HKEY_CURRENT_USER\Software\Classes\Applications\electron.exe\shell\open]
[HKEY_CURRENT_USER\Software\Classes\Applications\electron.exe\shell\open\command]
@="\"D:\\sites\\mplayer\\mplayer-win32-x64\\electron.exe\" \"%1\""
https://github.com/electron-userland/electron-builder/wiki/Options https://github.com/electron-userland/electron-builder/wiki/electron-builder-core#FileAssociation
once #339 will be finished, we should be able to work on this.
Just got this error when testing stuff; this may be a problem for the implementation of this feature:
Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD
Fixed by app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required');