Recent

Author Topic: Program icon for Linux application  (Read 5259 times)

Bruno45

  • Newbie
  • Posts: 3
Program icon for Linux application
« on: October 16, 2006, 11:19:32 am »
How can I define a program icon for a Linux application.
For Windows I have made a rc-file that includes the MAINICON and compiled it to a res-file. Is there a similar approach for Linux?

Bruno

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Program icon for Linux application
« Reply #1 on: October 16, 2006, 01:41:27 pm »
Quote from: "Bruno45"
How can I define a program icon for a Linux application.
For Windows I have made a rc-file that includes the MAINICON and compiled it to a res-file. Is there a similar approach for Linux?


No, the concept of having a icon inside the executable to discribe it does not exist under Linux.

Try opening with konqueror or another graphical file manager your /usr/bin directory. All executables have the same icon.

What people do on Linux is distribute a icon image separated from the executable, and use that icon when creating shortcuts to the program, like a shortcut on the K Menu, for example.

Creating shortcuts is a big problem, because this is a Distribution-dependent task. On each distro this is done in a different way.

MadMike

  • New Member
  • *
  • Posts: 32
Re: Program icon for Linux application
« Reply #2 on: September 15, 2021, 02:54:56 pm »
Hi,

A bit late I know but is there not an 'icon' property for the main form? ('Form1.icon')

Mike

MarkMLl

  • Hero Member
  • *****
  • Posts: 3459
Re: Program icon for Linux application
« Reply #3 on: September 15, 2021, 05:47:10 pm »
Quote from: Bruno45
How can I define a program icon for a Linux application.
For Windows I have made a rc-file that includes the MAINICON and compiled it to a res-file. Is there a similar approach for Linux?

No, the concept of having a icon inside the executable to discribe it does not exist under Linux.

Try opening with konqueror or another graphical file manager your /usr/bin directory. All executables have the same icon.

Rubbish. Just because the average startup menu or file browser doesn't know how to find an icon doesn't mean that there is no icon, and programs running on the average desktop environment display icons for running and minimised programs entirely adequately.

HOWEVER, even though (as has already been pointed out) the Lazarus project options allow a graphic to be associated with the main form, this can- in my experience- get to be a bit erratic once multiple forms (windows) are involved.

Quote
What people do on Linux is distribute a icon image separated from the executable, and use that icon when creating shortcuts to the program, like a shortcut on the K Menu, for example.

Creating shortcuts is a big problem, because this is a Distribution-dependent task. On each distro this is done in a different way.

You badly need to familiarise yourself with the xdg utilities which are supported as standard by all major desktop environments. The overall standard includes what goes into the .desktop files, but also defines the command lines (if not the operation) of various utilities:

Code: [Select]
xdg-dbus-proxy (1)   - D-Bus proxy
xdg-desktop-icon (1) - command line tool for (un)installing icons to the desktop
xdg-desktop-menu (1) - command line tool for (un)installing desktop menu items
xdg-email (1)        - command line tool for sending mail using the user's preferred e-mail composer
xdg-icon-resource (1) - command line tool for (un)installing icon resources
xdg-mime (1)         - command line tool for querying information about file type handling and adding descriptions for new file types
xdg-open (1)         - opens a file or URL in the user's preferred application
xdg-screensaver (1)  - command line tool for controlling the screensaver
xdg-settings (1)     - get various settings from the desktop environment
xdg-user-dir (1)     - Find an XDG user dir
xdg-user-dirs-update (1) - Update XDG user dir configuration

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

renabor

  • Jr. Member
  • **
  • Posts: 73
Re: Program icon for Linux application
« Reply #4 on: September 15, 2021, 06:35:28 pm »
In the Options Menu, under Resources, you can simply add the .ico file, and that icon will be the default both for Linux and Windows executable!
FPC 3.2.2 | Lazarus 2.0.13 | Kubuntu 21.04 64bit

Renat.Su

  • Full Member
  • ***
  • Posts: 208
    • Renat.Su
Re: Program icon for Linux application
« Reply #5 on: September 15, 2021, 08:26:26 pm »
Under linux, I put the application icon in png format in a folder /usr/share/pixmaps/$app_name.png and add field-value icon=$app_name to /usr/share/applications/$app_name.desktop file. This is all set in the .deb package. Read more there

tetrastes

  • Full Member
  • ***
  • Posts: 131
Re: Program icon for Linux application
« Reply #6 on: September 15, 2021, 09:25:22 pm »
Quote from: Bruno45
How can I define a program icon for a Linux application.
For Windows I have made a rc-file that includes the MAINICON and compiled it to a res-file. Is there a similar approach for Linux?

No, the concept of having a icon inside the executable to discribe it does not exist under Linux.

Try opening with konqueror or another graphical file manager your /usr/bin directory. All executables have the same icon.

Rubbish. Just because the average startup menu or file browser doesn't know how to find an icon doesn't mean that there is no icon, and programs running on the average desktop environment display icons for running and minimised programs entirely adequately.

HOWEVER, even though (as has already been pointed out) the Lazarus project options allow a graphic to be associated with the main form, this can- in my experience- get to be a bit erratic once multiple forms (windows) are involved.

Quote
What people do on Linux is distribute a icon image separated from the executable, and use that icon when creating shortcuts to the program, like a shortcut on the K Menu, for example.

Creating shortcuts is a big problem, because this is a Distribution-dependent task. On each distro this is done in a different way.

You badly need to familiarise yourself with the xdg utilities which are supported as standard by all major desktop environments. The overall standard includes what goes into the .desktop files, but also defines the command lines (if not the operation) of various utilities:

Code: [Select]
xdg-dbus-proxy (1)   - D-Bus proxy
xdg-desktop-icon (1) - command line tool for (un)installing icons to the desktop
xdg-desktop-menu (1) - command line tool for (un)installing desktop menu items
xdg-email (1)        - command line tool for sending mail using the user's preferred e-mail composer
xdg-icon-resource (1) - command line tool for (un)installing icon resources
xdg-mime (1)         - command line tool for querying information about file type handling and adding descriptions for new file types
xdg-open (1)         - opens a file or URL in the user's preferred application
xdg-screensaver (1)  - command line tool for controlling the screensaver
xdg-settings (1)     - get various settings from the desktop environment
xdg-user-dir (1)     - Find an XDG user dir
xdg-user-dirs-update (1) - Update XDG user dir configuration

MarkMLl

Note that the post of felipemdc is dated 2006, the year when xdg-utils were released.   :D
It's not wondering that he did not familiarise himself with them.   ;)

MarkMLl

  • Hero Member
  • *****
  • Posts: 3459
Re: Program icon for Linux application
« Reply #7 on: September 15, 2021, 09:46:01 pm »
Note that the post of felipemdc is dated 2006, the year when xdg-utils were released.   :D
It's not wondering that he did not familiarise himself with them.   ;)

Good heavens, I didn't realise I was commenting to such an ancient thread! My apologies for my bad humo(u)r, and my apologies in particular for directing such at Felipe.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

VTwin

  • Hero Member
  • *****
  • Posts: 1075
  • Former Turbo Pascal 3 user
Re: Program icon for Linux application
« Reply #8 on: September 16, 2021, 01:27:19 am »
In the Options Menu, under Resources, you can simply add the .ico file, and that icon will be the default both for Linux and Windows executable!

Yes. It does not show up on the executable, but does in the dock when running it, at least in Ubuntu.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.0
macOS 10.13.6: Lazarus 2.0.12 (64 bit Cocoa)
Ubuntu 18.04.3: Lazarus 2.0.12 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.12 (64 bit on VBox)

 

TinyPortal © 2005-2018