evshiron / nwjs-builder

https://www.npmjs.com/package/nwjs-builder
76 stars 12 forks source link

Missing .desktop launch file in Linux builds #32

Closed nicklaw5 closed 8 years ago

nicklaw5 commented 8 years ago

For both the 32 and 64 Linux builds, there is no .desktop file that is necessary to launch the application.

You can read the specs for a .desktop file here

Below is the example I have used in my application

Filename: launcher.desktop

[Desktop Entry]
Version={version}
Name={name}
Comment={description}
Exec=bash -c '_PWD="$PWD"; cd "`echo $0 | sed s/launcher.desktop$//`"; ./{name} run; cd "_PWD"' %k
Icon=needs_to_be_the_absolute_file_path_to_your_app/my-logo.png
Terminal=false
Type=Application
Categories=Utility;Application;

I found the Exec command which works great, but not sure how to populate the Icon path since it needs to be the absolute path to the project. However, once the files are extracted we wont know where this path is. Perhaps you can come up with a solution.

Also note that the .desktop file needs to have execution permissions, but I don't this can be done when packing the zip. At least from from my own testing I wasn't able save the file permission after zipping the directory.

evshiron commented 8 years ago

I noticed file modes were reset in util.ZipDirectory, and now in nwjs-builder 1.11.3, nw should be executable after extracting on Linux. For .desktop files, they are designed to be used with Desktop Environments like GNOME and KDE. As it's customizable and environment-related (there might be further requests like "adding an option to modify .desktop's category" or "placing .desktop at specified path"), I don't want to add this as a feature of nwjs-builder itself. As I have no idea where you will extract the files, a postinstall script executed by package managers like npm, dpkg and rpm should be a better solution. nwjs-builder can't really do much about this.

nicklaw5 commented 8 years ago

ok thanks, ill look into those package managers.