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

Create shortcut on Windows #4381

Closed
KochiyaOcean opened this issue Feb 5, 2016 · 8 comments
Closed

Create shortcut on Windows #4381

KochiyaOcean opened this issue Feb 5, 2016 · 8 comments

Comments

@KochiyaOcean
Copy link

Our project is trying to use toast notification on Windows, which requires a shortcut with AppUserModelID on Windows 8.1.
Is it possile to provide a method to create a shortcut with customizable AppUserModelID?
Similar to gui.App.createShortcut on the bottom of https://github.com/nwjs/nw.js/wiki/Notification

@felixrieseberg
Copy link
Member

It's not a bad idea, I can build that. @kevinsawicki: The code is fairly simple, I'm just not sure which object should host the method. Thoughts?

@kevinsawicki
Copy link
Contributor

Sorry, just want to get more context here, how would this be different than the app. setAppUserModelId API http://electron.atom.io/docs/v0.36.5/api/app/#app-setappusermodelid-id-windows ?

@felixrieseberg
Copy link
Member

The only addition would be to have an API that automatically creates a shortcut on the user's start menu. From my point of view, there's no definite need to put it into Electron - in theory, an external module and some documentation here would probably already do the trick for most people*.

EDIT: *Happy to write said documentation, of course.

@kevinsawicki
Copy link
Contributor

Yeah, I thought https://github.com/Squirrel/Squirrel.Windows handled this correctly already so I'm not sure if a core API is needed here. I'd be curious what others think.

@anaisbetts
Copy link
Contributor

Squirrel.Windows does indeed already create shortcuts with AppUserModelID set, it's always:

com.squirrel.{YOUR NUGET PACKAGE ID}.{YOUR EXE NAME MINUS DOT EXE}

So:

com.squirrel.atom.Atom

or

com.squirrel.slack.Slack

@anaisbetts
Copy link
Contributor

One thing that's been On My List is to have Electron itself just automatically set your App User Model ID for you if you're Squirrel-installed, something like:

  1. If "{My Executable's Directory}/../Update.exe" exists
  2. Get the name of "{My Executable's Directory}/../.." which is the NuGet Package ID
  3. Combine it with the executable name, bingo bango, we can build an AppUserModelID

If someone submitted a PR to that effect it would be amaaaaazing

@KochiyaOcean
Copy link
Author

I don't want to use Squirrel so I forked from https://github.com/j201/windows-shortcuts and add set appUserModelId function to it. This module works fine now so I'll close this issue. Thanks for your help 😃
https://github.com/KochiyaOcean/windows-shortcuts

@Chaaaaap
Copy link

Does the AppUserModelID have to be "com.squirrel.xx.yy" in order for Squirrel to correctly update pins and shortcuts?

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

No branches or pull requests

5 participants