godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.17k stars 98 forks source link

Add `.desktop` file generation to Linux export template #6547

Open vPumpking opened 1 year ago

vPumpking commented 1 year ago

Describe the project you are working on

any game for linux

Describe the problem or limitation you are having in your project

if I wan't to create a linux desktop shortcut or other, I have to do it myself

Describe the feature / enhancement and how it helps to overcome the problem or limitation

add a "generate .desktop file" option to the linux exporter template that makes a desktop file with an icon in the export directory (next to the executable and the pck)

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

this will generate a file as this one:

[Desktop Entry]
Name={project name}
Comment={project description}
Exec={executable path}
Terminal={true or false}
Icon={icon in the same directory}
Type={Game or Application}
Categories={Entertainment or other};

(replace the {} fields by the right values)

If this enhancement will not be used often, can it be worked around with a few lines of script?

yes but it's less convenient

Is there a reason why this should be core and not an add-on in the asset library?

linux export template is part of the official export templates, it's better to make it official

Calinou commented 1 year ago

You generally can't run .desktop files by double-clicking them, as the executable path must be absolute (or the binary must be located in PATH). If the generated .desktop file contains an absolute path, then it would break as soon as you move the executable somewhere else (even if you move the .desktop file alognside).

Therefore, I'm not sure how much benefit this would provide in practice. Most people seem to be relying on Steam or other launchers to provide desktop integration for games (you can add non-Steam games on Steam).

vPumpking commented 1 year ago

You generally can't run .desktop files by double-clicking them, as the executable path must be absolute (or the binary must be located in PATH). If the generated .desktop file contains an absolute path, then it would break as soon as you move the executable somewhere else (even if you move the .desktop file alognside).

Therefore, I'm not sure how much benefit this would provide in practice. Most people seem to be relying on Steam or other launchers to provide desktop integration for games (you can add non-Steam games on Steam).

yes I know (but we can maybe make a setup software that modifies the file for us and places it in the right directory) but if there is a .sh file for the game that breaks if it's moved, there is no reason to not have the same with a .desktop file we can make the .desktop file using relative pathes only

Calinou commented 1 year ago

but if there is a .sh file for the game that breaks if it's moved

The .sh file can be made to work even if it's moved, as long as the binary is moved alongside. I don't see a way to do this with a .desktop file, because these don't allow relative paths to be used in the first place.