Simple question - how to change the icon of a script.py file ?

Hello all,

"Simple question". That is how they all start. :-)

But seriously, how do I change the displayed icon of, in my current case, a script.py file ?

I've found some instructions to how to change them for a application (editing its *.desktop file), but have not come across anything in regard to non-application files.

As for the icon itself, I see that under "/usr/share/icons" there are a lot of subgroups (folders), all for (I assume) specific circumstances. No idea where I would need to store a new filetype icon ...

tl;dr: Is there a description available to how to change/add new icons for non-application files ?

Regards, Rudy Wieser

Reply to
R.Wieser
Loading thread data ...

That information is likely to be in either the Debian reference manual (free download) from

formatting link
or your desktop manager's reference manual.

I keep icons for my apps in ~/archive/icons - so put them anywhere that suits you in the user that will use them, or in /usr/local. if more they'll be used on more than one login. Use image editors to make the icons. I use .jpg, .png .svg images for that, so you can use the Gimp to draw them. I prefer to use xfig, a vector editor, because its easier to draw straight lines, rectangles and text with it. Then use your desktop's built-in tools to set up icons and link them to the relevant scripts or executables.

--
Martin    | martin at 
Gregorie  | gregorie dot org
Reply to
Martin Gregorie

Martin,

Yep, lets just try to dig thru all of it in search for something I do not even know what its called. :-(

Ah, so it isn't just a case of "place your icon /there/, edit /this/ file and reboot".

In short, I could do with a bit more than just a "use the force, luke" encouragement ...

Regards, Rudy Wieser

Reply to
R.Wieser

Icons are assigned by mime type. Every file / desktop manager has its own mime type database and icon directory, I don't know where Raspbian's PCManFM / LXDE keep theirs. So that's one way, but all .py files would get the new icon. Otherwise just go with the .desktop file: exec=/home/pi/myfile.py, icon=/home/pi/myicon.png

Reply to
A. Dumas

Alexandre,

I just found that out too. I did not quite expect it (too accustomed to the way Windows does it). Luckily I came across someone having icon problems with his *.py files, which attented me to it. as a result I've placed an "# python" line at the top of my python script files.

I /think/ that its stored under "/usr/share/icons/PiX" - which does not have a "scalable" subfolder, indicating that it does not want to have anything to do with my "text-x-python.svg" file. Took me a while to figure that one out. :-|

Thats my intention, yes. To make the script files stand out from any kind of documentation or other files I've put into the same folder.

I just realized that those files work independant of the "program" that are aimed at (was assuming that it was for applications only). Much like .LNK fils on Windows.

Regards, Rudy Wieser

Reply to
R.Wieser

Or read thje manual and/or manpages for the desktop manager you're using. Its difficult to say more without knowing which it one that is.

I use XFCE and its solution is to right click somewhere on the desktop, select 'Create Launcher'. This opos up a dialogue for entering a name for the launcher, the command it should run, its working directory, and what icon to use. Obviously, that requires to you know the comand and its parameters, the working directory(if any) that it will use and the full pathname of the icon.

Other desktop managers may differ.

Try using a web search and/or 'apropos'.

Providing somewhat more information will get you better help.

--
Martin    | martin at 
Gregorie  | gregorie dot org
Reply to
Martin Gregorie

Martin,

[quote=me] Yep, lets just try to dig thru all of it in search for something I do not even know what its called. :-( [/quote]

I'm not looking to change a single files icon (I could have created a .desktop file for that. Yup, found that too.)

Take a "wild guess" to what I've been dong before, and after having posted my question. And how many results-and-tries-thereof have already failed. Including trying to use an .svg "icon" , placed in several "does it need to go /there/ ?" folders, and ultimatily figuring out that an .svg "icon" does not work. That alone took me a couple of hours. :-(

Thats like a mechanic (you) asking a mere car driver (me) to tell him whats wrong with the engine. :-(

I thought I made clear I have /no/ idea what I should be looking for. And that also means I have no idea what kind of information is important - which means I depended on you guys to tell me what you need.

But by a "lucky guess" of rightclicking the bar at the top of the screen and seeing an "about" entry showed me that I'm using LXPanel 0.10.0

If you have a simpler/more straight-forward method than to create an .xml file in /usr/share/mime/packages folder which specifies the mimetype, the files comment as wel as its icon (no path, no extension) and afterwards running "sudo update-mime-database $PWD" in the parent directory than I would still like to know.

Regards, Rudy Wieser

Reply to
R.Wieser

Thats what you should have said in the first place. Unlike windoze, there are a LOT of different desktop window managers. They do not all work the same or look the same though they do the same task.

However, the 'about' display is common to just about everything, so now you know about it, use it to find out what program and version of it you are asking about. Additionally, a web search for any program, once you know its name, will often turn up a manual, so looking for it and having a read before posting here will save everybody some time.

Yes, I know this is quite un-windows like, but UNIX and clones such as Linux are generally well documented and the manuals are often indexed.

As an added hint, when writing scripts its useful to know about 'apropos' and manpages. Both are command line tools. 'apropos' lists one line descriptions of every tool whose manpage summary line contains your search term. 'man name' shows a page describing how to use the program, system feature or library routine whise name was retrieved by 'apropos'.

I already said XFCE has a simple tool for doing that. RTFM for your window manager, which I've never used, and you'll probably find it has something similar, so use that.

--
Martin    | martin at 
Gregorie  | gregorie dot org
Reply to
Martin Gregorie

Get a copy of "Linux In A Nutshell" and READ IT and practise doing what it says. That might give you enough of a clue to work out how to use the (extensive) help systems (apropos, man and web searches).

How do you think I learnt to use the various operating systems, programing languages and databases I've used over the years? BY READING THE MANUALS.

Where I've worked the attitude has always been: "You've heard of it? Just the man we need on this new project! Here are the manuals: you start next week." - and I wouldn't have it any other way.

So, help yourself: do some reading and stop snarking.

--
Martin    | martin at 
Gregorie  | gregorie dot org
Reply to
Martin Gregorie

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.