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

Menu/Dock Icons #38

Merged
merged 9 commits into from
Nov 20, 2023
Merged

Menu/Dock Icons #38

merged 9 commits into from
Nov 20, 2023

Conversation

gariel
Copy link
Contributor

@gariel gariel commented Nov 19, 2023

Hello, I was playing around with this project and implemented the shortcuts for the current selected version of Godot

The implementation feels really hacky and I think I made some questionable decisions on where to place some of the code, but, the idea is here

Features tested, respecting the selected current version:

  • MacOS: Launchpad Icon
  • MacOS: Pinned on Dock
  • Linux: Gnome App Grid (should work for the majority of Desktop Environments)
  • Linux: Gnome Dock
  • Windows: Start Menu shortcut (also pinned on Start Menu)
  • Windows: Pinned on Task Bar

As I said, I coudn't really spot the best place for some of the code, please let me know if you think of any changes and of course, feel free to deny it if you think its too hacky haha

For MacOS:

Creating an .app directory on the users Applications dir so Mac recognizes it as a program, then symlinking every file from godot current selected version does the trick

In fact, linking the binary (Godot.app/Content/MacOS/godot) whould be enought but it could lead to wrong informations on the app metadata and the files not linked whould have to be copied from somewhere

image

For Linux:

The app menus on linux are kinda similar to Mac, but instead of the actual app it has a .desktop file with all the information (like the plist on mac), so creating one and pointing to the "bin" symlink is enough

It also works if it's created point to the actual binary, but some menu apps/desktop environments can cache these .desktop files and keep pointing to the wrong version until a force refresh (like reboot or logging off)

The problem with linux is that executables doesn't have icons, so there is a png download for placing on the user's icons dir

image
image

For Windows:

This was a hard one, because Start Menu only works with .lnk files (the normal shortcut file), Web Shortcut files could also work but there is the cache again

Also, the shortcut is only a pointing file and the real instance of godot (even pointing to the symlink) whould be the real .exe file, so creating a hard link can trick Windows to think the link is the real .exe and even pinning on task bar works this way

For creating a normal shortcut the I used a small powershell script importing the WScript (it could also be imported via C# but it would not be available on mac and linux)

image

Solves #30

@gariel gariel changed the title Menus/Docks Icons Menu/Dock Icons Nov 19, 2023
@jolexxa
Copy link
Member

jolexxa commented Nov 19, 2023

First off, this is a huge undertaking, so thank you! This will obviously be a very nice thing to have for users, and while it can't solve everything (non-Gnome distributions), this will have a huge usability impact so we WILL get this merged in, one way or another.

As for where to put things, this seems fine. GodotEnv has kind of a "nebulous" codebase, to put it nicely. I think it's because everything GodotEnv does is kind of messy and highly detailed, so it's really hard to keep the code clean.

The hard part here is making all the CI/CD checks still work — we have to be able to verify the automated installations work. Seems like Ubuntu doesn't like messing with stuff on the GitHub runners (probably a permissions thing). We should probably have some work around for this. Perhaps just a try/catch or something to suppress potential failures (and maybe output a warning or something). I can take a closer look when I'm back at my desk if you need help.

@gariel
Copy link
Contributor Author

gariel commented Nov 19, 2023

Ahh, I assumed every linux installation had the .local/share/applications dir (default for desktop environments) , changed the code to ensure it's created

@jolexxa jolexxa merged commit 8d9daf7 into chickensoft-games:main Nov 20, 2023
6 checks passed
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.

2 participants