Have TreeView3's app icon and name appear in the dock and in the Finder/Explorer

Issue #482 closed
Robert Leach created an issue

USE CASE: WHAT DO YOU WANT TO DO?

Give the user a real app experience instead of a generic jar icon named "java"

STEPS TO REPRODUCE AN ISSUE (OR TRIGGER A NEW FEATURE)

  1. Double-click the TreeView3 jar
  2. Hover cursor over the jar in the dock

CURRENT BEHAVIOR

The app appears as a generic jar icon named "java" in the dock on Mac OS.

EXPECTED BEHAVIOR

The attached icon should be how it appears in the dock and the name upon hover should be "TreeView3".

DEVELOPERS ONLY SECTION

SUGGESTED CHANGE (Pseudocode optional)

use gradle

FILES AFFECTED (where the changes will be implemented) - developers only

unknown

LEVEL OF EFFORT - developers only

medium

COMMENTS

Note, this issue is a splitting/re-org. of issue #123. That issue was intended to be about the app icon and name, but turned into a generic issue about multiple system deployment. I just thought that the app icon task needed a separate focus. I will edit that issue to reflect all the various issues that are involved in multiple system deployment.

Comments (20)

  1. Robert Leach reporter

    Hey @TreeView3Dev - logo.png exists in 2 places: src/main/resources/logo.png and build/resources/main/logo.png. Which one should be used?

  2. Robert Leach reporter

    Note, I had to create a .icns file for the Mac App icon to be properly assigned in gradle. I used the following commands to create it:

    mkdir TreeView3.iconset
    sips -z 16 16 logo.png --out TreeView3.iconset/icon_16x16.png
    sips -z 32 32 logo.png --out TreeView3.iconset/icon_16x16@2x.png
    sips -z 32 32 logo.png --out TreeView3.iconset/icon_32x32.png
    sips -z 64 64 logo.png --out TreeView3.iconset/icon_32x32@2x.png
    sips -z 128 128 logo.png --out TreeView3.iconset/icon_128x128.png
    sips -z 256 256 logo.png --out TreeView3.iconset/icon_128x128@2x.png
    sips -z 256 256 logo.png --out TreeView3.iconset/icon_256x256.png
    sips -z 512 512 logo.png --out TreeView3.iconset/icon_256x256@2x.png
    sips -z 512 512 logo.png --out TreeView3.iconset/icon_512x512.png
    sips -z 512 512 logo.png --out TreeView3.iconset/icon_512x512@2x.png
    iconutil -c icns TreeView3.iconset
    

    I also had to trim the size of the logo.png file, which I did to the icon in build/resources/main.logo.png, to be a perfect square. It went from 360x357 pixels to 357x357.

    The resolution of the largest icon (512x512) will be a little low-res because while I have the .ai file, I don't have a copy of Illustrator on my work iMac.

  3. Robert Leach reporter

    So it looks like, with the edits I made to the gradle build file, you just have to run gradle createApp and it generates a .app app:

    tv3indock.png

  4. Robert Leach reporter

    Hey @TreeView3Dev, could you switch to my branch (issue482-...) and see if you can run gradle createApp on the command line or whether my changes to the gradle build script create problems on other systems? I.e. Run it on linux and/or windows?

    I read that gradle createDmg will only work on Mac OS X, so it looks like to create the download file, we'll have to generate it on a Mac. Maybe you could confirm that that won't run on your system...?

  5. Robert Leach reporter

    Now that I think about it, gradle createApp probably won't work for you because I didn't define anything for linux or windows...?

  6. Christopher Keil repo owner

    I haven't had a chance to try it yet, but it is great that it works well (from Anastasia's reaction). I am not sure why this issue was created (it is implicit to #123) so should we consider #123 as an integrated issue of all the issues listed under "Suggested Changes" in #123?

    I am asking because I don't want to mark #123 as resolved until all the issues of that list are resolved, if that is our approach.

  7. Robert Leach reporter

    Issue #123 was really multiple issues. The title didn't match the description. I felt it needed granularized and parsed out. I viewed it as just the icon, though getting gradle running is really an issue in its own right, so I felt that that didn't need to be married to the icon. However, I turned #123 more into a sort of touchstone for an integrated system experience, which more matched the title instead of the description. I felt that the icon deserved its own priority so we could push it forward.

  8. Christopher Keil repo owner

    Yea that's fine, I just want to be clear on how to approach the issue since it is assigned to me. It could be treated as overarching achievement. In my opinion the milestone should then be changed to the hybrid C/R-01 because effectively we are both contributing.

    Another note on this specific issue here which I encountered a few days ago: It seems like it would be best to create .app files over .dmg files. The reason is that the creation of .dmg internally requires Mac-native libraries or processes while .app does not.

    If gradle is run from Windows or Linux, the .dmg will fail but .app will not. We can certainly let the script create .dmg files only if it is run on a Mac.

  9. Robert Leach reporter

    Yeah, I noted that about .dmg creation. Do you think we should make the download a zip file then? Because I don't know if downloading a .app file is going to cause problems for some users given their security settings... Also, I noted that Lance's computer wouldn't even let him download the .dmg without circumventing security measures that prevent downloads from developers not registered with Apple. Maybe we should register with Apple somehow? Or maybe Princeton has a university-wide app developer ID? I noticed that gradle lets you set one.

  10. Robert Leach reporter

    .dmg is pretty much the standard for installing new software on Macs. I might advocate we just jump through the hoop of generating it on a mac anytime we release... though it is inconvenient. It's debatable.

  11. Robert Leach reporter

    A note on the background image in the dmg (caveat - I know we may not end up doing dmg releases, but in case we do...)... The DPI of the background image has to be set at 72 or else the icon appears really small in the top left corner. The initial size of the mounted dmg is correctly calculated, but I had tried to compensate for the small background image by simply increasing its size, which made the dmg finder window's size really huge. Today I figured out the real solution. The DPI of the background image can be changed by doing the following:

    cd build/resources/main
    sips -s format tiff -s dpiWidth 72 -s dpiHeight 72 TreeView3-dmgbackground.png --out TreeView3-dmgbackground.tif
    sips -s format png -s dpiWidth 72 -s dpiHeight 72 TreeView3-dmgbackground.tif --out TreeView3-dmgbackground-tmp.png
    mv TreeView3-dmgbackground-tmp.png TreeView3-dmgbackground.png
    cp TreeView3-dmgbackground.png ../../../src/main/resources/
    

    You have to convert to a new format when setting the DPI due to a bug in Apple's sips utility.

  12. Anastasia Baryshnikova

    Just my 2 cents: what's the advantage of using .dmg over .app? compression? How much we'd be saving in file size?

    I think by default Mac OS warns you when you try to run apps by unknown developers but lets you proceed anyway. That happens for me for most new software (including those distributed via dmg).

  13. Robert Leach reporter

    Downloading dmgs is a fairly standardized way for doing mac installations. You end up with a .app in the end. The question is really whether to use .dmg or just plain .zip. I would expect that downloading a base .app file could cause security issues because a .app "file" is actually a directory that is just treated differently by the file system.

    So between .dmg and .zip, I would vote .dmg given its standardization and because it gives us that polished panache that I think a user notices and recognizes as a serious app.

    Besides, with Bitbucket's pipelines feature, the generation of the .dmg is handled in a virtual environment and can be automated that way. I know Chris was concerned about not being able to generate it on Windows, but if we use BitBucket pipelines, then that's not so much of an issue.

    Incidentally, I'm only encountering these issues because in order to get the icon in the dock and in the finder (and the app name) to implement this issue, I have to run either gradle createApp or gradle createDmg and when I started, I was also using the icon as the background... so really the dmg thing should be a separate BB issue... I guess I just got interested in it.

  14. Robert Leach reporter

    Merged to master. If we want a similar icon/name for windows and linux users, we should create another issue, since I'm not really the one who should develop that. I don't know the conventions.

  15. Log in to comment