Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Position of application icon is changing based on position of hidden files #225

Open
m-kovac opened this issue Mar 30, 2023 · 3 comments
Open

Comments

@m-kovac
Copy link

m-kovac commented Mar 30, 2023

Our team is experiencing weird behaviour with only application icon shown in visible area. When the hidden icons are moved to the right out of the visible area following happens:

  1. If the icons are hidden, the icon position is as defined in appdmg.json
  2. If user has com.apple.finder "AppleShowAllFiles" set to true or simply hit the CMD+Shift+. then the position of icon is shifted.

We thought that this is issue with the appearing scrollbar, but the shift is too big, scrollbar is only few dozens pixels wide and shift is hundred or even more(did not measure exactly). We also tried to move icons down under the visible area. The icon moves counterintuitively to the right closer to the scrollbar. Is there something we are doing wrong in appdmg.json file?

DMG when com.apple.finder "AppleShowAllFiles" is true and and hidden icons are under the visible area

HiddenDown

Here is the content of the appdmg.json file

{
  "title": "App",
  "icon": "icon.icns",
  "background": "background.png",
  "background-color": "mintcream",
  "icon-size": 96,
  "window": {
    "position": { "x": 200, "y": 200 },
    "size": { "width": 400, "height": 400 }
  },
  "contents": [
    { "x": 200, "y": 200, "type": "file", "path": "App.app" },
    { "x": 0, "y": 600, "type": "position", "path": ".background" },
    { "x": 0, "y": 600, "type": "position", "path": ".DS_Store" },
    { "x": 0, "y": 600, "type": "position", "path": ".Trashes" },
    { "x": 0, "y": 600, "type": "position", "path": ".VolumeIcon.icns" }
  ]
}

DMG when com.apple.finder "AppleShowAllFiles" is true and hidden icons are right to visible area

HiddenRight

Here is the content of the appdmg.json file

{
  "title": "App",
  "icon": "icon.icns",
  "background": "background.png",
  "background-color": "mintcream",
  "icon-size": 96,
  "window": {
    "position": { "x": 200, "y": 200 },
    "size": { "width": 400, "height": 400 }
  },
  "contents": [
    { "x": 200, "y": 200, "type": "file", "path": "App.app" },
    { "x": 600, "y": 0, "type": "position", "path": ".background" },
    { "x": 600, "y": 0, "type": "position", "path": ".DS_Store" },
    { "x": 600, "y": 0, "type": "position", "path": ".Trashes" },
    { "x": 600, "y": 0, "type": "position", "path": ".VolumeIcon.icns" }
  ]
}

DMG when com.apple.finder "AppleShowAllFiles" is false

OK

@jozefizso
Copy link

We finally understood what the issue is.

TLDR: Icon size and position must be chosen so there is no room left around the icon for any of the hidden icons.

1. Only specify application in the content

Define size and position of the application only in the contents section. Alternatively include link to the /Applications folder.

Remove references to any of the hidden files.

2. Make app icon prominent

Based on the DMG window size you must make application icon quite large.

Finder will position visible hidden files automatically on the grid around the application icon. Your goal is to make it large enough and the space between window and icon must be less than icon-size * 2 - this will make sure visible hidden files will not be placed to any of the visible area.

@jozefizso
Copy link

Small application icon

When the application icon is small enough, Finder will position hidden files around it and in the visible area of the window.

As there may be background graphic with instruction for installing the app those hidden files may obscure it.

Screen Shot 2023-05-16 at 11 09 36 Screen Shot 2023-05-16 at 11 12 47

Large application icon

Making the icon large enough will move hidden icons out of visible area.

The window size is 480, application is positioned at 240x240 to be in the center and its size is 172.

com.apple.finder "AppleShowAllFiles" = false

Screen Shot 2023-05-16 at 11 14 53

com.apple.finder "AppleShowAllFiles" = true

Hidden files will cause the scrollbar to apear but it won't affect the design of the window.

Screen Shot 2023-05-16 at 11 14 57

Sample appdmg.json config

{
  "title": "Bunny app",
  "icon-size": 172,
  "contents": [
      { "x": 240, "y": 240, "type": "file", "path": "dist/BunnyApp.app" }
  ],
  "window": {
    "size": { "width": 480, "height": 480 }
  }
}

@cdwmhcc
Copy link

cdwmhcc commented Dec 10, 2023

same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants