Recent

Author Topic: How to add Application Icon?  (Read 13808 times)

abb

  • New Member
  • *
  • Posts: 40
How to add Application Icon?
« on: March 16, 2007, 08:07:10 am »
Hi, All,

Not most important aspect though, but yet interesting -- how to add the icon to show it in Finder for .APP format, created for an executable, created with Lazarus? Should it be added to the executable itself or should be it placed somewhere within .APP directory?

Thanks.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2582
RE: How to add Application Icon?
« Reply #1 on: March 16, 2007, 12:12:31 pm »
Not yet implemented, maybe it can be done with the Info.plist inside the .app dir
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: How to add Application Icon?
« Reply #2 on: March 16, 2007, 05:02:40 pm »
Quote from: "abb"
Should it be added to the executable itself or should be it placed somewhere within .APP directory?


Everything the executable needs goes in the .app bundle. This includes the icon (32x32) file, help files, localized strings, any "private" libraries or frameworks, etc. It sounds like you haven't discovered this:

http://developer.apple.com/documentation/MacOSX/

abb

  • New Member
  • *
  • Posts: 40
Re: How to add Application Icon?
« Reply #3 on: March 17, 2007, 06:58:15 pm »
Quote from: "Phil"
Everything the executable needs goes in the .app bundle. This includes the icon (32x32) file,......

OK, but why 32x32 size only? AFAIK icns supports multisized icons.
Quote from: "Phil"

http://developer.apple.com/documentation/MacOSX/

I've found a .plist specification, where there is icon definition. I've downloaded Iconographer and have created icns file, and I've tried to add it into the APP Resourses/ folder and modified the plist file.... no luck.
Here is a part of my .plist file:
Code: [Select]
 <key>CFBundleIconFile</key>
  <string>monitor</string>

monitor.icns is placed into Resourses/ subdirectory, but there is no effect.
I tried to include the ".icns" file extention here -- no luck. I've read that I need to logout/login to see APP changes, I tried it but with the same result.

What I'm doing wrong?

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: How to add Application Icon?
« Reply #4 on: March 17, 2007, 08:40:12 pm »
Quote from: "abb"

OK, but why 32x32 size only? AFAIK icns supports multisized icons.

I've found a .plist specification, where there is icon definition. I've downloaded Iconographer and have created icns file, and I've tried to add it into the APP Resourses/ folder and modified the plist file.... no luck.
Here is a part of my .plist file:
Code: [Select]
 <key>CFBundleIconFile</key>
  <string>monitor</string>

monitor.icns is placed into Resourses/ subdirectory, but there is no effect.
I tried to include the ".icns" file extention here -- no luck. I've read that I need to logout/login to see APP changes, I tried it but with the same result.

What I'm doing wrong?


Ideally you would have a 128 x 128 icon. Finder will scale it down for lower resolutions if needed. However, if you're moving an icon over from Delphi it will be 32 x 32. This can be scaled up to 128 x 128 and still looks fairly good.

Why aren't you using OS X's Icon Composer?

I would include the icon file's extension in the Info.plist.

Finder appears to be a bit weird sometimes about "refreshing" the icon for an .app when you change the icon. Try dragging the app to a different folder and see if that works. I've also read that logging out works. You could also try relaunching Finder (Esc-Option-Apple keys).

When you install the app on your users' computers you won't have this problem since they've never had the app with the default icon that Finder used for your app originally.

abb

  • New Member
  • *
  • Posts: 40
Re: How to add Application Icon?
« Reply #5 on: March 18, 2007, 09:51:43 am »
Quote from: "Phil"
Why aren't you using OS X's Icon Composer?

I've checked it, but it does not support 8-bit masks, at the same time Iconographer does. I create icons from PNG files with transparency channel. Therefore 8-bit mask is more suitable. I do it for XP and why not to do it for Mac OS?
Quote from: "Phil"
I would include the icon file's extension in the Info.plist.

Yes, I've done it now.
Quote from: "Phil"
Finder appears to be a bit weird sometimes about "refreshing" the icon for an .app when you change the icon.

You're correct. I've zipped the app folder and moved zip into another directory, and unzipped it. The app appears in Finder with the correct icon.

WOW!

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: How to add Application Icon?
« Reply #6 on: March 18, 2007, 05:18:10 pm »
Quote from: "abb"
You're correct. I've zipped the app folder and moved zip into another directory, and unzipped it. The app appears in Finder with the correct icon.


You shouldn't have to zip the app folder to move it. In Finder, just drag (move) the app to a different folder.

abb

  • New Member
  • *
  • Posts: 40
Re: How to add Application Icon?
« Reply #7 on: March 19, 2007, 07:42:25 pm »
Quote from: "Phil"
You shouldn't have to zip the app folder to move it. In Finder, just drag (move) the app to a different folder.

Yes, I understand it, but... I use MUCommander as a file manager because I don't like Explorer-style managers... In Windows I use FAR Manager, and the first app what I've started to seek for MacOS was anything like that. All is OK, but it looks like MUCommander loses execution attribute while file copying. Hope this bug will be fixed... So, I've got nothing when I copied the APP folder by MUCommander, thefore I've decided just zip it and move. Of course I know about chmod...

But indded you're correct that Finder works correctly with files, so it is easy just to drag the APP into another folder.

tearsfornations

  • New Member
  • *
  • Posts: 35
  • Jesus is worth talking about.
    • Lightning Bolt Quiz - How many Lightning Bolts do you deserve?
Re: How to add Application Icon?
« Reply #8 on: April 18, 2023, 05:47:07 am »
I realize it is 2023 now, but how do I add an icon for macos? .app
-
Used C++Builder for the longest time, got macOS, How many Lightning Bolts do you deserve? Find out at my website: https://boltquiz.org

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: How to add Application Icon?
« Reply #9 on: April 18, 2023, 01:12:35 pm »
See my Wiki article Apple-specific UI Elements - Adding an icon to your app bundle.

The Wiki has lots more macOS info and code - start at the macOS Portal page for a summary of the content.

 

TinyPortal © 2005-2018