Application icons in Linux

Deploying to Linux? Get penguinated here.

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
andyh1234
Posts: 379
Joined: Mon Aug 13, 2007 4:44 pm
Location: Sale UK / FL USA
Contact:

Application icons in Linux

Post by andyh1234 » Tue Apr 08, 2008 10:16 pm

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

Ocean
Posts: 16
Joined: Wed May 03, 2006 4:29 am

Post by Ocean » Thu Apr 17, 2008 1:37 pm

I would also like to know how to set an application icon in Linux. Thanks!

Garrett
Posts: 386
Joined: Sat Apr 08, 2006 8:15 am
Contact:

Post by Garrett » Thu Apr 17, 2008 6:49 pm

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

sphere
Posts: 700
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth

Re: Application icons in Linux

Post by sphere » Mon Nov 05, 2018 1:04 pm

Hi,

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

Thanks!
:D :o :) :shock: 8) :lol:

bogs
Posts: 2279
Joined: Sat Feb 25, 2017 10:45 pm

Re: Application icons in Linux

Post by bogs » Mon Nov 05, 2018 2:16 pm

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.
Image

sphere
Posts: 700
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth

Re: Application icons in Linux

Post by sphere » Tue Nov 06, 2018 1:07 pm

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
:D :o :) :shock: 8) :lol:

bogs
Posts: 2279
Joined: Sat Feb 25, 2017 10:45 pm

Re: Application icons in Linux

Post by bogs » Tue Nov 06, 2018 5:09 pm

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.
Image

sphere
Posts: 700
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth

Re: Application icons in Linux

Post by sphere » Tue Nov 06, 2018 6:25 pm

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
:D :o :) :shock: 8) :lol:

bogs
Posts: 2279
Joined: Sat Feb 25, 2017 10:45 pm

Re: Application icons in Linux

Post by bogs » Tue Nov 06, 2018 10:32 pm

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.
Image

sphere
Posts: 700
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth

Re: Application icons in Linux

Post by sphere » Wed Nov 07, 2018 12:59 pm

Ubuntu Mate latest version
:D :o :) :shock: 8) :lol:

bogs
Posts: 2279
Joined: Sat Feb 25, 2017 10:45 pm

Re: Application icons in Linux

Post by bogs » Wed Nov 07, 2018 1:48 pm

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 :|
Image

bogs
Posts: 2279
Joined: Sat Feb 25, 2017 10:45 pm

Re: Application icons in Linux

Post by bogs » Wed Nov 07, 2018 4:58 pm

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
Image

sphere
Posts: 700
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth

Re: Application icons in Linux

Post by sphere » Wed Nov 07, 2018 8:33 pm

Thanks a lot Bogs for all your explanation and tryig. I will check it out and test some of your great tips.
:D :o :) :shock: 8) :lol:

Post Reply

Return to “Linux”