HeroicGamesLauncher icon indicating copy to clipboard operation
HeroicGamesLauncher copied to clipboard

Support adding game shortcuts on Mac

Open arielj opened this issue 4 years ago • 12 comments

Is your feature request related to a problem? Please describe.

Currently, the Add shortcuts action is not present in Mac

Describe the solution you'd like

The app should show the Add shortcuts button on Mac and should add the icons in the correct places

arielj avatar Oct 31 '21 14:10 arielj

Hmm I can't make games work on MacOS. Seems like Legendary does not officialy support MacOS https://github.com/derrod/legendary/discussions/169 and after following that discussion's instructions I still can't get any game to run so I can't really test if a shortcut works if I manage to create one (which seems to be also really complicated on MacOS).

Is there any documentation on how to get this running on Mac? maybe I'm missing something

arielj avatar Oct 31 '21 16:10 arielj

Legendary doesn't support Mac yet but we have a legendary binary compiled for MacOSX that works on Heroic. You need to install Crossover and create a new bottle called Heroic. Then on the game settings, after installing it, just select the crossover app under Wine, and then the crossover bottle you write Heroic if it doesn't detect automatically.

flavioislima avatar Oct 31 '21 17:10 flavioislima

About how Shortcuts works on Mac, I have no idea, you will need to do some research. You also need to check if the protocol is being registered since Heroic is using the heroic:// protocol on Mac but I don't know how to call it. On the logs, when running heroic from the terminal, or when running yarn electron on the terminal in dev mode, you can check if the protocol is being registered. I think you will need to start there, checking the protocol and then checking how to call this protocol under mac and then generating the shortcuts.

flavioislima avatar Oct 31 '21 17:10 flavioislima

Oh I'll check with crossover, I was trying with wine and any game I tried failed to start.

About the protocol, I tried and it works with open heroic://launch/..., I have to do some more research on how to create a shortcut after I get some games working on mac

arielj avatar Oct 31 '21 22:10 arielj

https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/AccessingFilesandDirectories/AccessingFilesandDirectories.html#//apple_ref/doc/uid/TP40010672-CH3-SW10

ghost avatar Dec 04 '21 23:12 ghost

I was doing some research for this but I can't find a way to create a desktop icon that will execute open heroic://launch/.... There seems to be no way to even do that manually on OSX.

I can do a symlink pointing to the executable file maybe, but skipping heroic when opening the game sounds like a bad idea so I don't want to try it if it's useless.

arielj avatar Jan 12 '22 03:01 arielj

I was doing some research for this but I can't find a way to create a desktop icon that will execute open heroic://launch/.... There seems to be no way to even do that manually on OSX.

I can do a symlink pointing to the executable file maybe, but skipping heroic when opening the game sounds like a bad idea so I don't want to try it if it's useless.

THIS is why mac sucks. Are mac desktop shortcuts plain text?

ghost avatar Jan 12 '22 20:01 ghost

I couldn't find a way to make a simple desktop shortcut, there's no option on the mac (you can make an alias of an app and move the alias to the desktop, but the content has a lot of unknown data, it's probably binary.

What I was thinking is that maybe we can create bash scripts, it won't have the game icon, but it should work to run games from the desktop.

I was also checking this https://apple.stackexchange.com/questions/224394/how-to-make-a-mac-os-x-app-with-a-shell-script, maybe we can make a .app with a script inside and I think that supports an icon as png. I'll try to prototype this to try it

arielj avatar Jan 12 '22 22:01 arielj

I managed to create a GameName.app osx app with a shell script inside that executes open heroic://launch//game-name but something might be not allowed because it opens Heroic but never launches the game (the open heroic://launch/game-name command works fine if I run it manually in the terminal).

I'll try a few more things but I think we may not be able to create shortcuts on MacOS (at least from what I understand with all the things I tried)

arielj avatar Jan 13 '22 17:01 arielj

I managed to create a GameName.app osx app with a shell script inside that executes open heroic://launch//game-name but something might be not allowed because it opens Heroic but never launches the game (the open heroic://launch/game-name command works fine if I run it manually in the terminal).

I'll try a few more things but I think we may not be able to create shortcuts on MacOS (at least from what I understand with all the things I tried)

Did you try to quote "heroic://launch/game-name" ?

This is somehow needed if you add this as none-steam-game aswell.

heroic --no-gui "heroic://launch/game-name"

Nocccer avatar Jul 13 '22 06:07 Nocccer

I managed to create a GameName.app osx app with a shell script inside that executes open heroic://launch//game-name but something might be not allowed because it opens Heroic but never launches the game (the open heroic://launch/game-name command works fine if I run it manually in the terminal). I'll try a few more things but I think we may not be able to create shortcuts on MacOS (at least from what I understand with all the things I tried)

Did you try to quote "heroic://launch/game-name" ?

This is somehow needed if you add this as none-steam-game aswell.

heroic --no-gui "heroic://launch/game-name"

I found the underlaying issues, one is fixed in PR #1501 (which was merged already) and the other one is fixed here https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/pull/1559

With those 2 fixes I can create a <game name>.app file that opens heroic and the game just fine. What I'm struggling now is to set the icon for the .app. Currently the only option I found I doing it manually after the file is created. I was trying to read the source code of Electron Builder and some other apps to understand how they do that programatically but I couldn't find a way yet.

arielj avatar Jul 13 '22 12:07 arielj

You could diff the .app file with and without an image. Maybe it is a pattern you can make use of. Like shortcuts.vdf of steam. It is a binary following a structure.

Edit: Found this message in the internet: "After you assign any icon, if you look in your .app directory, you should see a filename that starts with Icon."

Nocccer avatar Jul 13 '22 12:07 Nocccer