Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to associate supported file types with museeks #154

Closed
YurySolovyov opened this issue Aug 17, 2016 · 9 comments · Fixed by #782
Closed

Make it possible to associate supported file types with museeks #154

YurySolovyov opened this issue Aug 17, 2016 · 9 comments · Fixed by #782

Comments

@YurySolovyov
Copy link
Collaborator

YurySolovyov commented Aug 17, 2016

It should be possible to make museeks default app for supported file types

Related: #155

@martpie
Copy link
Owner

martpie commented Sep 11, 2016

refs (last Atom version)

atom

@martpie martpie added this to the 0.8 milestone Sep 15, 2016
@martpie martpie mentioned this issue Sep 21, 2016
18 tasks
@YurySolovyov
Copy link
Collaborator Author

@dkniffin
Copy link
Collaborator

It looks like this may be unsupported? electron/electron#2651

@martpie
Copy link
Owner

martpie commented Nov 21, 2016

Atom does it. We might need to find how they managed to do that.

@martpie martpie removed this from the 0.8 milestone Dec 1, 2016
@OutsourcedGuru
Copy link

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.

@OutsourcedGuru
Copy link

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\""

@martpie
Copy link
Owner

martpie commented Mar 10, 2019

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

@martpie
Copy link
Owner

martpie commented Mar 10, 2019

Fixed by app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants