Page 1 of 5

Application icons in Linux

Posted: Tue Apr 08, 2008 10:16 pm
by andyh1234
Sorry for all the questions!

On Mac and Windows we set the application icons in the standalone build settings, and these icons also get put on the top of the stack in windows.

Now, for Linux there does not seem to be the same option, and the icon on the top of the stack in Ubuntu is a little square.

Is there a way to change this, Ive dug round the help files and the icon command, but dont seem to be able to hit the right combination of code to pop an icon up there.

Thanks again!

Andy

Posted: Thu Apr 17, 2008 1:37 pm
by Ocean
I would also like to know how to set an application icon in Linux. Thanks!

Posted: Thu Apr 17, 2008 6:49 pm
by Garrett
It's been a while since I last had to deal with this, but if I remember correctly, setting the icon for my own apps before I had to copy some .png files to the /usr/ area somewhere and had to put an entry in a config file somewhere, or was issue a console command? Sorry, but I just can't remember at the moment. But I can tell you that Linux does not use embedded icons in exectuable files. The images are stored in a directory somewhere, and likely the icons are only linked to shortcuts to the programs. I don't think the exectuables ever have icon associations in linux.

~Garrett

Re: Application icons in Linux

Posted: Mon Nov 05, 2018 1:04 pm
by sphere
Hi,

it's an old post but i would like to know too.
And why can't we choose it at standalone settings?

Thanks!

Re: Application icons in Linux

Posted: Mon Nov 05, 2018 2:16 pm
by bogs
The post was a little before my time here, but I'll give explaining it a shot sphere :D

The first problem for Lc is that there are a crap ton of places on 'nix where you *could* put an icon for your app to use, including the folder of the app itself. There are several cases where apps from the repositories fail to properly get their icons right for a particular desktop/distro, where as with Win and OSX, there is only 1 place that is sanctioned.

The end result is that you have 3 choices with 'nix, you can -
. put the icon in the folder with your app and include instructions for how to use it, or
. you can do a LOT of reading for each distro, and setup your own automated way to do it, or
. you can put it in the most likely place and *hope* that it all works out :P

As to the *where* icons go, your most likely candidate for almost all systems is going to be in "/usr/share/icons/"
icons - File Manager_079.png
Where do icons go...
Even there you have choices, you can 'chose' to put it in the themes folder that the user is using, you can put it in the general icons folder (not all themes draw from there), or you can put it in all the possible folders. Note- you will need admin privileges just to place the icon somewhere outside of the users folder!

A secondary choice is in the home folder in a hidden folder for your program, where you would also place any preferences, individual to that user's scripts, etc (resources for your program in effect). This doesn't require admin privileges :D
Selection_081.png
Hide and seek!
Now, once you have figured out where your icon is going to go, you then have to create the directions 'nix will use to place it on the application starter for the menu or desktop launcher which vary by (you guessed it) distro and desktop. The most likely way your going to do this is with a desktop config file which goes (you guessed it) where ever the distro/desktop your user is using determines it goes. There are places more likely than not, and of course there is always the users directory in that hidden folder you made for preferences.
Blender_2-80.desktop - KWrite_080.png
KDE 3 Desktop.config file...
*The above is my most likely "guess" as to why Lc doesn't delve into it for the standalone maker, and they certainly are not alone in that as I mentioned earlier, however there are plenty of tutorials and tracts dedicated to actually configuring this yourself for your programs and Lc *has* been getting the icon right for Lc itself since about version 7.x or the late 6.x series (past 6.5). Before that, on more distros than not, I configure the launcher icons manually for Lc itself.

Hope that helps to some degree.
--------------------------------------
* My opinion only, not based on fact or knowledge, just an (un)educated guess :P

Edit 1 - Or where the Lc IDE is concerned, the original scripts that placed the icons may have just broken over time like the launch after install did, I believe 2.2.1 placed its icon correctly.

Edit 2 - the original Mc which started out on 'nix I had to manually configure the icon as well, so not limited to Lc.

Edit 3 -
Garrett wrote: It's been a while since I last had to deal with this, but if I remember correctly, setting the icon for my own apps before I had to copy some .png files to the /usr/ area somewhere and had to put an entry in a config file somewhere, or was issue a console command?
This has changed since Garrett wrote this answer, icons can be .png, .gif, .svg(specific format though), or any number of other graphic formats. Your still better off using the user's home directory and a hidden folder for the icon placement imho if you can swing it, as mentioned above, any folder in the filesystem is going to require admin privileges to write to it.

Packages added to the system through your package manager already have this permission granted, all pkg. managers require root permission to launch.

Re: Application icons in Linux

Posted: Tue Nov 06, 2018 1:07 pm
by sphere
That's a great and a BIG answer Bogs !
And i thank you for it :D :mrgreen: :D :mrgreen:

Why did Linux get this right the first time and made it some easier....

Anyway i will investigate it and see if i can manage it to get it done.

Cheers!
Sphere

Re: Application icons in Linux

Posted: Tue Nov 06, 2018 5:09 pm
by bogs
No problems, glad it was helpful in some way :D
sphere wrote:
Tue Nov 06, 2018 1:07 pm
Why didn't Linux get this right the first time and make it some(thing/what) easier....
I'm not sure I have this right, but I made the bold words what I thought you meant. If I didn't get it right, you can set me straight :wink:

I've been using various unix systems for close to 30 years, I think they *did* get it right :shock:
Setting an icon for a program can be as simple as shelling out to a cli, or even getting the parameters from with in your Lc script, then -

Code: Select all

# openbox - 
xseticon -id "$WINDOWID" path/to/icon.png
Mostly what you have with the various 'nixes is a great deal of freedom to make the OS your own that is lacking in the other two major OSes, or at least, it isn't nearly so easy. I think this is great because my work flow may not be your work flow, something I think looks great might look like doggerel to you. Even within the same distro/desktop, if I think something works better from a different setup, I can put it in to the one I'm running.

Just as a "for instance", I like the MATE desktop, but don't particularly care for the way the panels work. I *do* however, LOVE the way XFCE panels work. To make it worse, I actually like some features of the MATE panels :P

I can just install and run XFCE panels from inside the MATE desktop, giving me what I consider the best of both worlds. But if you don't like a change Ms made to the start menu, well, there are ways around it but they sure aren't as easy to implement.

Since I had some time, I took a look and found this article, which gives you the basics both from the command line, and from the various GUIs with the different desktops.

The command line option *should* cover about 98% of your needs, and that file (unlike what the article says) does *not* necessarily have to go to one of those system folders, although that is the correct place for it.

For instance, you can create a .desktop file on most distros/desktops directly on/in the desktop folder (or as I mentioned above, in the user's home folder, preferably in a preferences folder you made for your application), then you would refer the shortcuts you create for your program to that file. Often times, though, it is easiest to just have the user escalate to admin/root permissions and take a shotgun approach to creating the file in the correct locations. The actual icon you can place in one (or all) possible locations, my preference is a preferences folder made for the application in the home folder.

Re: Application icons in Linux

Posted: Tue Nov 06, 2018 6:25 pm
by sphere
Yes very nice article.
But having that all together in a script while installing the apllication would be better, so no trouble for the one putting it on their Linux PC.

I'm going to check out some installers, and hope they provide some sort of solution for it.
Like i used Inno Setup for Windows which makes a nice installer

So here are a lot of alternatives for multiple platforms:
https://alternativeto.net/software/clic ... l-creator/

And hopefully also to overcome the question every time if i want to execute it as a program or command line when i click the LC standalone

Re: Application icons in Linux

Posted: Tue Nov 06, 2018 10:32 pm
by bogs
sphere wrote:
Tue Nov 06, 2018 6:25 pm
And hopefully also to overcome the question every time if i want to execute it as a program or command line when i click the LC standalone
Which distro are you running? Usually it is a system setting that resolves that issue.

Re: Application icons in Linux

Posted: Wed Nov 07, 2018 12:59 pm
by sphere
Ubuntu Mate latest version

Re: Application icons in Linux

Posted: Wed Nov 07, 2018 1:48 pm
by bogs
Downloading and installing :D

Ok, keep in mind that the setting we're talking about is to protect you from installing/running malicious applications, and that the following instructions are not a recommendation by me ( I expect you to know whether or not you really want this :P ), on MATE it turns out to be pretty simple.

You can simply open CAJA (the file manager), go to Edit -> Preferences, Behavior tab, and where it says "Executable Text Files" select "Run exectuable text files when they are opened". The reason you get asked is because the "Ask each time" is checked by default.
StepOsTesters [Running] - Oracle VM VirtualBox_079.png
Ask, and you shall receive...
You can also get there via the control center...
StepOsTesters [Running] - Oracle VM VirtualBox_080.png
Alternate method...
*Edit - you know I just found out something I said previously doesn't apply to Ubuntu's version of MATE :shock:

The discussion involved the 'launch after install' working or not. While it works in almost all other distros with MATE I have used, it apparently falls flat on its face in this one, which I guess should indicate that correcting the mistake in the installer would be preferential to trusting to luck :roll:

Now I'll have to go find that post and correct it :|

Re: Application icons in Linux

Posted: Wed Nov 07, 2018 4:58 pm
by bogs
While playing around today, I found some very old (but still accurate) tips from Ken Ray that is a worth while read.
http://www.sonsothunder.com/devres/live ... lin001.htm

Re: Application icons in Linux

Posted: Wed Nov 07, 2018 8:33 pm
by sphere
Thanks a lot Bogs for all your explanation and tryig. I will check it out and test some of your great tips.

Re: Application icons in Linux

Posted: Mon Dec 24, 2018 9:56 pm
by bogs
I never did get this thread out of my mind Sphere, so for you, I scripted this launcher maker (Linux only).
*Edit - I found an error in my code, you can download the fixed version(s) here.

It is heavily commented just in case my coding isn't clear. It can be used as is, or, if you want to include it in your standalone that you give to someone else, can be very easily completely automated.

Inside the .zip file, you'll find a folder with a launcher executible, and a livecode stack. Unzip it inside the folder of a standalone program where you have only 1 executable and, preferably, either a .png or .svg picture file (for the icon).
Selection_003.png
Whats inside the box ?
You can test it in one of two ways -
  • If you have multiarch setup for your distro, you can click on the CreateLauncher (32bit only, if your running straight 64bit it won't work)
  • you can open the livecode file in the IDE. (Edit - it is saved in Lc 5.5 format)
When the .livecode file is launched, it takes the path of the CreateLauncher file, navigates up one folder, looks for the exe and icon and, if they are there, will create paths for them and write out the launcher to the launcherRes folder.

The .desktop file produced can be checked with any linux text editor, but you'll see the output in the livecode file when running -
Create Linux Desktop Launcher Automatically..._004.png
Dis must be da place...
Even though it writes the file after opening, you *can* modify some of the contents and write it out again. The combo box lists the various menu categories, and the comment is so you can put in what the program does. The comment affects this tooltip in a menu -
Selection_008.png
Oh, the tooltip!
Hope you enjoy it, Merry Christmas Image

Re: Application icons in Linux

Posted: Tue Dec 25, 2018 12:58 pm
by sphere
mmmmmm, mmmmm, mmmmmm
Well that's absolutely fabulous!
Thanks a lot for this x-mas present from you Bogs.
If you were a pretty girl i would give you a kiss, but i guess you aint. So i'm sending you a High Five 8) :lol:

I will test it out. And i know for sure you did me and others a big favour.
I'm creating 64bits versions for a project i'm working on for a year now. Containing a mobile app and some desktop apps which are supporting it. For internal use i want to use Linux and for customers win/mac/lin.
But it's not completely ready yet.

I'll let you know how it works.

Thanks again!