Sign in Join
Wiki copytemporary

Application Icon: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11The application icon is usually displayed on the main window of the application, and it can be changed as per the code in [[Changing application Icon]].
22
33To change the icon of the executable itself, it is necessary to employ a platform-dependent technique. In Lazarus 0.9.27 support for this was added to the Project Options dialog, but it currently doesn't work for Linux because it requires calling an application to set the icon.
44
55## IDE support for the Application Icon
66
77Just set the icon in the Project Options dialog, accessible in the Project menu.
88
99Works for Windows and macOS.
1010
1111## Platform-specific techniques
1212
1313### Windows
1414
15151\. Create a new file named "project.rc" (for example) containing:
1616
17-`  MAINICON ICON "editor.ico" `
17+```
18+ MAINICON ICON "editor.ico"
19+```
1820
19212\. Include in you project *.lpr file the following instruction:
2022
21-`  {$R project.rc} `
23+```
24+ {$R project.rc}
25+```
2226
2327Work with version 0.9.24 and above.
2428
25293\. In the article [[Windows Icon]] you can see the best practices for creating the icon.
2630
2731### Setting the Application Icon on macOS
2832
2933Under macOS it is necessary to set an icon for the Application Bundle. This is done by adding a field to the Info.plist file, like this:
3034
3135``` xml
3236 <key>CFBundleIconFile</key>
3337 <string>iconfile.icns</string>
3438```
3539
3640Where iconfile.icns is located inside MyBundle.app/Contents/Resources
3741
3842You can find instructions to create an icns file [here](http://www.macinstruct.com/node/59)
3943
4044### Linux
4145
4246Under Linux application icons are located in special directories which are different on each Window Manager. The structure inside that directory, however, is standardized and described on the [Icon Theme Specification](http://www.freedesktop.org/Standards/icon-theme-spec).
4347
4448In order to determine how an application is launched the operating system uses a text file with the extension *.application*. This file provides different information including a description of the application, categories and locations of the executable and the icon. The standard is described in the [Desktop Entry Specification](http://www.freedesktop.org/wiki/Specifications/desktop-entry-spec/) of freedesktop.org.
4549
4650#### K Desktop Environment (KDE)
4751
4852You can find the directory for application icons for use by all users and for each user using the command:
4953
50-`kde-config --path icon`
54+```
55+kde-config --path icon
56+```
5157
5258This should print a list of colon-separated paths to stdout.
5359
5460#### GNOME
5561
5662You can find the directory for application icons for use by all users and for each user using the command:
5763
58-`gnome-config --datadir`
64+```
65+gnome-config --datadir
66+```
5967
6068This should print a path to stdout, inside which is found a directory called pixmaps that attends to the Icon Theme Specification.
6169
6270#### LXDE
6371
6472In LXDE, icons are located in the directory
6573
66-`/usr/share/pixmaps`
74+```
75+/usr/share/pixmaps
76+```
6777
6878.application files are in
6979
70-`/usr/share/applications`
80+```
81+/usr/share/applications
82+```
7183
7284---
7385*From the Free Pascal wiki, page "Application Icon", as it stood on 2020-08-02 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
7486Category: GUI
7587Category: Lazarus

Back to history