Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Standalone player icon on Linux

Discussion in 'Linux' started by Thomas_Riisbjerg_Triband, Mar 4, 2024.

  1. Thomas_Riisbjerg_Triband

    Thomas_Riisbjerg_Triband

    Joined:
    Jan 6, 2021
    Posts:
    2
    Hello! I'm trying to figure out how to get an icon on our standalone player when building for Linux. I've set the icon in Player Settings and I see the icon in <GAME>_Data/Resources/UnityPlayer.png, yet the executable itself just has a generic executable icon. Not really sure what to do from here.
     
  2. Thomas_Riisbjerg_Triband

    Thomas_Riisbjerg_Triband

    Joined:
    Jan 6, 2021
    Posts:
    2
    So, what I was really trying to fix was that desktop shortcuts would have a default Steam icon when Steam Linux users added shortcuts to their desktops. Adding proper client icons in the Steam backend solved this particular problem for the shortcuts, although the main executable still doesn't have an actual icon. From what I can read I'm not even sure this is possible on Linux desktop environments
     
  3. tylerinthezoo

    tylerinthezoo

    Unity Technologies

    Joined:
    Jun 15, 2022
    Posts:
    96
    the icon here on linux should be a title bar icon, rather than the icon shown for the binary when you are browsing it in the file system(if i understand you correctly). if you set an icon and start the binary, you should see the icon is used when you zoom out using the "windows" key on linux.

    in the case of steam icons, i currently have no knowledge how that should work on steam.
     
    Last edited: Mar 6, 2024
  4. karliss_coldwild

    karliss_coldwild

    Joined:
    Oct 1, 2020
    Posts:
    605
    Yes, for the most part icons are not a property of regular Linux executables (elf files).

    The icons you see for GUI applications that you install using your distros package manager, come from .desktop files. See https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html for more information.

    The way it's usually handled for software that's packaged as rpm, deb or whatever your distros main software package format, is that the package contains .desktop files which during installation get placed in special directory. That way they show up wherever your desktop environment lists available GUI software. Commandline tools usually don't have .desktop entries so they don't show up in all software menus.

    One major problem with .desktop files is that they need absolute path for the icon, preferably executable as well although that has a workaround. That's not a problem for software that's installed as .deb, .rpm like packages since those are designed for placing files in various specific system folders. But that's not really suitable if you want to distribute your software as single folder which can be placed wherever.

    Some other packaging formats like .appimage have their own mechanisms for specifying icon, same with steam. .

    One slightly different category is software with window like installers, it's not really common on Linux, but some software behave that way. In that case it's the responsibility of installer to generate and place in the correct directory the .desktop file, taking into account where the user chose to install the executable. I think some of GOG linux games had installers like this.

    Anyway the way you need to specify the icon depends on how you package and distribute your game.

    There also some software without installer which generates the desktop file and places it in user directory the first time you run it. I don't recommend this approach as it leaves behind mess after user erases the software. If you are using one of the other packaging approaches, avoid this even more. And it won't even help if something else like Steam "Add desktop shortuct" is creating it's own .desktop file, since it won't be aware of what kind of files your application is creating at runtime.


    The icon you see while the program is running is a different story. That one is somewhat controllable by application and should match the thing you specify in Unity settings. Not sure what exact OS API it uses, but I guess it works.
     
    tylerinthezoo likes this.