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

Support adding desktop and start menu shortcuts on windows #725

Merged

Conversation

arielj
Copy link
Collaborator

@arielj arielj commented Oct 31, 2021

<--- Put the description here --->

This PR implements the functionality of adding shortcut icons on Windows when the user clicks the Add shortcut action in the game page.

It also implements removing the shortcuts when the game is uninstalled.

I tried to make the Add desktop shortcuts automatically and Add games to start menu automatically settings work but there's some issue on Windows with the install callback that is not fired properly and it was getting too complicated to do both things on 1 PR so I decided to leave that for another moment.

I'm not really sure how to add tests for this since it's too tied to the system.

Closes #724


Use the following Checklist if you have changed something on the Backend or Frontend:

  • Tested the feature and it's working on a current and clean install.
  • Tested the main App features and they are still working on a current and clean install. (Login, Install, Play, Uninstall, Move games, etc.)
  • Created / Updated Tests (If necessary)
  • Created / Updated documentation (If necessary)

const shortcutOptions = {
target: launchWithProtocol,
icon: `${gameInfo.install.install_path}\\${gameInfo.install.executable}`,
iconIndex: 0
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the icon must be either from a DLL, the game exe file, or a .ico file, I couldn't use the same getIcon function used for linux

}
case 'win32': {
desktopFile = `${app.getPath('desktop')}\\${gameTitle}.lnk`
menuFile = `${app.getPath('appData')}\\Microsoft\\Windows\\Start Menu\\Programs\\${gameTitle}.lnk`
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though in spanish the Start menu is Menú Inicio, both Start Menu and Menú Inicio work, Windows understands Start Menu and Programs independent of the current system language

@flavioislima
Copy link
Member

Let me know when this is ready for review 👍🏽

@arielj
Copy link
Collaborator Author

arielj commented Nov 4, 2021

hey @flavioislima this is ready for review!

Copy link
Member

@flavioislima flavioislima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good.
Also like the refactoring, things are more clear and easy to understand. Nice.
If you have tested well on Linux and Windows we can merge it.
I won't be able to test it today, but I can do it tomorrow.

@arielj
Copy link
Collaborator Author

arielj commented Nov 4, 2021

yes! I tested it in windows 10 and linux mint, adding shortcuts manually and uninstalling games after and things are added and removed correctly

I'm happy if anybody wants to test it though, I'm not really sure how to add an automated test for this

@flavioislima flavioislima merged commit e7ec3cb into Heroic-Games-Launcher:main Nov 5, 2021
@arielj arielj deleted the add-shortcuts-on-windows branch November 6, 2021 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support adding game shortcuts on Window
2 participants