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

Adding icon for the editor to Linux DE launchers #6405

Closed
ghost opened this issue Sep 5, 2016 · 18 comments
Closed

Adding icon for the editor to Linux DE launchers #6405

ghost opened this issue Sep 5, 2016 · 18 comments

Comments

@ghost
Copy link

ghost commented Sep 5, 2016

Operating system or device - Godot version:

Ubuntu 16.04.1 | Godot 2.1-stable

Issue description (what happened, and what was expected):

Godot icon is missing from the Unity launcher (grey with a question mark)
Also i try to "Lock to launcher" but nothing it's disappear after exiting Godot.

@reduz
Copy link
Member

reduz commented Sep 6, 2016

No idea how to fix this, anyone familiar with Ubuntu?

@notklaatu
Copy link

@CHRISANTHOS you need to install Godot if you want it to integrate with your system.

The easiest way to do that will probably be by installing godot via the Ubuntu Software Center, or via apt.

Otherwise, you should at the very least create a Godot.desktop file and place that in /usr/share/applications. In that .desktop file, point to the Godot binary as what should be launched (it's common to place extra binaries like this in /opt), and point to a location on your harddrive where the Godot icon can be located.

Ubuntu will then be able to use the Godot icon for the launcher (unity or otherwise) and the .desktop file as the basis for a launcher.

@Calinou
Copy link
Member

Calinou commented Sep 7, 2016

The easiest way to do that will probably be by installing godot via the Ubuntu Software Center, or via apt.

I don't think it'll be available in official Debian/Ubuntu repositories anytime soon. Maybe someone could maintain a PPA for easy installation on Ubuntu, though.

That said, for proper desktop integration, you will need to write a .desktop file and put it in ~/.local/share/applications.

Create a godot.desktop file containing something like this (modify the Icon path accordingly):

[Desktop Entry]
Type=Application
Name=Godot Engine
GenericName=Game engine
Comment=2D and 3D game engine
Exec=/usr/local/bin/godot
Icon=/absolute/path/to/icon/file

@ghost
Copy link
Author

ghost commented Sep 7, 2016

@Calinou I have try it but not working.

@notklaatu Can you give me steps how can i do it?

@notklaatu
Copy link

@CHRISANTHOS sure, here, I wrote this for you:
http://straightedgelinux.tk/unix/desktop/?dir=unix

@Aster89
Copy link

Aster89 commented Sep 10, 2016

I followed (another guide like yours), @notklaatu, and I guess I'm halfway from the solution. I mean, at the moment I have a godot.desktop file, displayed with name "Godot", and I put it in the Unity Launcher. When I click on it, the project management window of Godot opens, but a new icon (grey with question mark) appears in the launcher as well. When I choose the project to edit or create, this icon disappears as the window closes, and, more or less in the same moment, another identical one appears, with the project window opening.

To sum up, it's pretty much like this pretty icon I put in the launcher just allows me to open the Godot, but it's not strictly related to it. If fact, with Godot open, I see both icons; if I right click on "my" icon I can't see anything else then "Godot" and "Unlock from Launcher", whereas if I right click on the default one (question mark icon), I can also choose "Quit" (or close, or exit, don't know the english word used by Ubuntu).

@Aster89
Copy link

Aster89 commented Sep 10, 2016

Here is the solution, found in this answer on AskUbuntu.

Opening Godot the project list opens; entering xprop|grep WM_CLASS in a terminal and then clicking on the Project List window, one obtains:
WM_CLASS(STRING) = "Godot_ProjectList", "Godot"
so adding the line
StartupWMClass=Godot_ProjectList
to the .desktop file allow "merging" the icon of the project list with the cust icon we created. But this is not what we want, since when we choose a project, a second question mark icon appears, whereas the first one would disappear. So it's better to run xprop|grep WM_CLASS and then click on the editor, obtaining
WM_CLASS(STRING) = "Godot_Editor", "Godot"
in order to use this line in place of the preceding:
StartupWMClass=Godot_Editor
Doing so, the question mark icon of the project list appears, but when we chose a project it disappears, and the question mark icon of the editor is captured by the custom icon we created.

EDIT: I found (reading part of this) that we can simply use the second string, "Godot" to group both question mark icons under our custom icon; so the line in the .desktop file is now:
StartupWMClass=Godot

@akien-mga
Copy link
Member

As I understand it there's not much that can be done by Godot itself to fix this, no? The StartupWMClass solution described by @Aster89 is nice, though it would have to be applied by package maintainers (I'll have to give it a try, though for my Mageia package I don't have icon issues, but I guess /usr/bin/godot matches the desktop file automatically).

@sherden
Copy link

sherden commented Dec 7, 2016

Here is a set of scripts I'm using to "install" and "uninstall" Godot:

Files must be on same directory of the executable, in my case executable is Godot.64.
There must be the icon, in my case godot_alt.png (alt(ernative) because the original icon is flat,
so you visually get a square icon with eyes, make use an icon with an outline...)

This logic was found on Arduino IDE install scripts (as fallback, not using xdg-utils).

@MarufSarker
Copy link
Contributor

Create a .desktop file named godot.desktop with content -

[Desktop Entry]
Name=Godot Engine
Comment=Free and Open Source 2D and 3D Game Engine
Terminal=false
Type=Application
Categories=Development;IDE;
Keywords=game;engine;ide;
Exec=/complete/path/to/godot/executeable/for/linux
Icon=/complete/path/to/godot/icon/file/with/png_or_svg_or_else_type

[ change the Exec and Icon entries path according to your file(s) location(s) ]
[ you can find an icon file from GitHub repository, icon.png ]

Copy/Move the file into ~/.local/share/applications/

Make the godot.dektop file executable.
[ Using GUI method ]
[ Or, using command [chmod +x ~/.local/share/applications/godot.desktop] ]
[ DO NOT COPY-PASTE/USE COMMAND(S) FROM UNKNOWN SOURCE(S) ]
[ USE GUI METHOD INSTEAD ]

Now, you should see an entry named Godot Engine in Unity Launcher.
It is possible that, you might not see the icon image properly.
But if you have used proper path for the image, logging out-in or, restarting computer should solve this.

[ for new linux user(s), if you don't understand the ~/ place, it presents the Home folder for current user ]

Thanks :)

@mhilbrunner
Copy link
Member

This can be closed, I think

@capnm
Copy link
Contributor

capnm commented Dec 28, 2017

A cool solution to this problem would certainly be to add a pythonized version of #6405 (comment) as install/uininstall target in the Sconscript.

@ghost
Copy link
Author

ghost commented Apr 6, 2018

First of all thank you for your report and sorry for the delay.

We released Godot 3.0 in January 2018 after 18 months of work, fixing many old issues either directly, or by obsoleting/replacing the features they were referring to.

We still have hundreds of issues whose relevance/reproducibility needs to be checked against the current stable version, and that's where you can help us.
Could you check if the issue that you described initially is still relevant/reproducible in Godot 3.0 or any newer version, and comment about it here?

For bug reports, please also make sure that the issue contains detailed steps to reproduce the bug and, if possible, a zipped project that can be used to reproduce it right away. This greatly speeds up debugging and bugfixing tasks for our contributors.

Our Bugsquad will review this issue more in-depth in 15 days, and potentially close it if its relevance could not be confirmed.

Thanks in advance.

Note: This message is being copy-pasted to many "stale" issues (90+ days without activity). It might happen that it is not meaningful for this specific issue or appears oblivious of the issue's context, if so please comment to notify the Bugsquad about it.

@ghost
Copy link
Author

ghost commented Apr 6, 2018

.desktop file for linux can be found here https://github.com/godotengine/godot/tree/master/misc/dist/linux

@akien-mga akien-mga changed the title Godot icon is missing Adding icon for the editor to Linux DE launchers Apr 10, 2018
@akien-mga
Copy link
Member

As mentioned above that's not something that we can fix ourselves on Linux, executable don't have icon data. The files in https://github.com/godotengine/godot/tree/master/misc/dist/linux can be used for one's own local setup, or by package maintainers. Adding AppImage support as a distribution channel may also be an option, but it's tracked in #6681.

@mikeweilgart
Copy link

To install for multiple users on the computer (a family computer) I did the following on Kubuntu 20.04:

  1. First download the binary from https://godotengine.org/download/linux and extract it. In my case the file name was Godot_v3.2.1-stable_x11.64 but that will be different in the future.

  2. Put the binary in /usr/local/lib/ and fix the ownership.

    sudo mv Godot_v3.2.1-stable_x11.64 /usr/local/lib
    sudo chown root:root /usr/local/lib/Godot_v3.2.1-stable_x11.64
    
  3. Add a symlink so the program can be started just by running godot.

    sudo ln -s /usr/local/lib/Godot_v3.2.1-stable_x11.64 /usr/local/bin/godot
    
  4. Install the application icon in the appropriate directory per the "Installing Application Icons" section of https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html

    sudo wget -nc -P /usr/share/icons/hicolor/scalable/apps https://godotengine.org/themes/godotengine/assets/download/godot_logo.svg
    
  5. Added a PNG version of the icon also, as per recommendation in the above link, using Inkscape to convert the SVG to the right size per https://stackoverflow.com/a/14174624/5419599 (I have Inkscape 1.0). (This step could probably be skipped and the icon would still show up from the SVG version; I didn't test.)

    inkscape -w 48 -h 48 /usr/share/icons/hicolor/scalable/apps/godot_logo.svg --export-filename godot_logo.png
    # And place it appropriately
    sudo mv godot_logo.png /usr/share/icons/hicolor/48x48/apps/
    sudo chown root:root /usr/share/icons/hicolor/48x48/apps/godot_logo.png
    
  6. Make the launcher file as described in many comments here. Note that for mine, the Exec and Icon lines are especially simple because of appropriately placing the binary and the icon earlier. I also grabbed the version string from the binary.

    # Grab version string
    version="$(/usr/local/bin/godot --version)"
    # Create godot.desktop file
    cat > godot.desktop << EOF
    [Desktop Entry]
    Version=$version
    Name=Godot
    Exec=godot
    Icon=godot_logo
    Terminal=false
    Type=Application
    Categories=Application;Development;
    Comment=Free and open source 2D and 3D game engine
    Keywords=engine;game engine;
    EOF
    # And place it correctly.
    sudo mv godot.desktop /usr/share/applications/
    sudo chown root:root /usr/share/applications/godot.desktop
    

Godot then shows up in the application menu, or when searched for, just as though it had been installed from any of the various graphical software installers (e.g. Software Center):

Screenshot_20200603_161925

@Calinou
Copy link
Member

Calinou commented Jun 4, 2020

@mikeweilgart Note that we provide a .desktop file already, so you don't have to write your own: https://github.com/godotengine/godot/blob/master/misc/dist/linux/org.godotengine.Godot.desktop

Also, while it's nice to do, changing the ownership isn't required for desktop integration to work. (The install command might be able to handle it for you, by the way.)

@domdfcoding
Copy link

The Unity launcher and icons for .desktop files (which appear in the Dash AKA Start Menu) are orthogonal concepts. The launcher icon comes from the window's icon. With wxPython that's set with wx.TopLevelWindow.SetIcon. That works straight from Python with no installation or a .desktop file. I don't know the equivalent for godot's toolkit but I suspect there is one, as GTK and Qt can do it too.

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