Sign in Join
Wiki copytemporary

Application Icon: what changed

Revision 2 to 3. 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-```
17+```text
1818 MAINICON ICON "editor.ico"
1919```
2020
21212\. Include in you project *.lpr file the following instruction:
2222
23-```
23+```text
2424 {$R project.rc}
2525```
2626
2727Work with version 0.9.24 and above.
2828
29293\. In the article [[Windows Icon]] you can see the best practices for creating the icon.
3030
3131### Setting the Application Icon on macOS
3232
3333Under 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:
3434
3535``` xml
3636 <key>CFBundleIconFile</key>
3737 <string>iconfile.icns</string>
3838```
3939
4040Where iconfile.icns is located inside MyBundle.app/Contents/Resources
4141
4242You can find instructions to create an icns file [here](http://www.macinstruct.com/node/59)
4343
4444### Linux
4545
4646Under 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).
4747
4848In 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.
4949
5050#### K Desktop Environment (KDE)
5151
5252You can find the directory for application icons for use by all users and for each user using the command:
5353
54-```
54+```text
5555kde-config --path icon
5656```
5757
5858This should print a list of colon-separated paths to stdout.
5959
6060#### GNOME
6161
6262You can find the directory for application icons for use by all users and for each user using the command:
6363
64-```
64+```text
6565gnome-config --datadir
6666```
6767
6868This should print a path to stdout, inside which is found a directory called pixmaps that attends to the Icon Theme Specification.
6969
7070#### LXDE
7171
7272In LXDE, icons are located in the directory
7373
74-```
74+```text
7575/usr/share/pixmaps
7676```
7777
7878.application files are in
7979
80-```
80+```text
8181/usr/share/applications
8282```
8383
8484---
8585*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).*
8686Category: GUI
8787Category: Lazarus

Back to history