fvarrui / JavaPackager

:package: Gradle/Maven plugin to package Java applications as native Windows, MacOS, or Linux executables and create installers for them.
GNU General Public License v3.0
1.07k stars 133 forks source link

Can Desktop Shortcut for Windows install be different than project name? #318

Closed EasyG0ing1 closed 1 year ago

EasyG0ing1 commented 1 year ago

Is there a way to assign a name for the shortcut that is generated on the Desktop during a Windows install that is different than the name of the project? For example, suppose the project name is SessionManager but the shortcut that gets created gets word-wrapped so that the word session has the last few letters chopped down to the next line of the icon label. It would be nice to assign a different label for that icon (for example Session Manager in this case so that it word wraps the label at the space making the appearance and the label of the icon more aesthetically pleasing for the end user.

fvarrui commented 1 year ago

Hi @EasyG0ing1! sorry for my late reply!

I think it's possible using a custom iss.vtl template.

Just copy iss.vtl file to ${project_root}/assets/windows and change this line:

https://github.com/fvarrui/JavaPackager/blob/fe278a1eb7c0fa94eb30f73a77f864eafa3e377f/src/main/resources/windows/iss.vtl#L88

to:

 Name: "{autodesktop}\Session Manager"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\\${info.iconFile.name}"; Tasks: desktopicon 

and the next time you build your app with JP it will use this template instead of the default one.

Maybe in the future we can add a new property to Windows specific configuration to set up the shortcut name.

I hope it helps!

fvarrui commented 1 year ago

Hi @EasyG0ing1! Did you finally manage to change shortcut name this way?

EasyG0ing1 commented 1 year ago

@fvarrui - Sorry, I just now saw this ... I will check this out and get back to you asap.

EasyG0ing1 commented 1 year ago

@fvarrui - I tested the iss.vtl template as you instructed and it worked beautifully!

Thank you so much!

fvarrui commented 1 year ago

Maybe we can add a new option: displayName, as a better human readable name, setting it to $name by default?

EasyG0ing1 commented 1 year ago

@fvarrui - This can be easily done so that it is a setting in the pom file?

EasyG0ing1 commented 1 year ago

@fvarrui I'm tracing out the code now trying to understand it ... I'm going to submit this in a PR here very soon hopefully.

fvarrui commented 1 year ago

Fixed with PR #329

fvarrui commented 1 year ago

1.7.3 released to Maven Central