FreeCAD document icon
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
FreeCAD document icon
Hi guys,
I opened a feature request in Mantis for FreeCAD to use a thumbnail as the icon for FreeCAD documents. There's a setting in Preferences to generate such a thumbnail and save it in the project file, but it does not seem to be used at the moment. Having it for the file's icon would be cool!
But I understand it may require coding, so meanwhile, I'd like to use a custom icon. It is easy to do in Windows, but in GNOME, all I'm able to do is set it to one file only through its preferences. What do you think would be required for me to set it to all .fcstd files on Ubuntu?
The file I want to use is here.
Thanks!
I opened a feature request in Mantis for FreeCAD to use a thumbnail as the icon for FreeCAD documents. There's a setting in Preferences to generate such a thumbnail and save it in the project file, but it does not seem to be used at the moment. Having it for the file's icon would be cool!
But I understand it may require coding, so meanwhile, I'd like to use a custom icon. It is easy to do in Windows, but in GNOME, all I'm able to do is set it to one file only through its preferences. What do you think would be required for me to set it to all .fcstd files on Ubuntu?
The file I want to use is here.
Thanks!
Re: FreeCAD document icon
I may have found the way, it has to do with mimetypes.
I'm reading this document right now: https://help.ubuntu.com/community/AddingMimeTypes
I'll update this message a little later.
I'm reading this document right now: https://help.ubuntu.com/community/AddingMimeTypes
I'll update this message a little later.
Re: FreeCAD document icon
Well it doesn't work. The Ubuntu wiki page talks about editing the /etc/mime.types file, then copying the wanted icon in /usr/share/icons/gnome/scalable/mimetypes.
I tried the following combinations in the /etc/mime.types file:
Nothing works. The last one I tried to see if the problem was that the FreeCAD document is actually a zip container. But even with a step file, which is just text, it doesn't work.
Oh well...
I tried the following combinations in the /etc/mime.types file:
Code: Select all
application/fcstd fcstd FCStd
application/freecad fcstd FCStd
model/fcstd fcstd FCStd
model/freecad fcstd FCStd
text/fcstd fcstd FCStd
text/freecad fcstd FCStd
text/step stp step STP STEP
Oh well...

Re: FreeCAD document icon
Ok,
I found this page which uses a python script to get info on a file: https://help.ubuntu.com/community/Pytho ... /MIMETypes
With this script, I was able to determine the actual freecad document mime type:
So I thought, the mime type is already known by the system, I just need to copy my icon to the right place and with the right name.
I named it application-x-extension-fcstd.svg and copied it in two places:
/usr/share/icons/gnome/scalable/mimetypes
/usr/share/icons/Humanity/mimes/48 (which seems to host most of the icons on Ubuntu Lucid)
Logged off for the umpteenth time, logged in... still no custom icon. I though, maybe my svg (made from merging with Inkscape an existing text document svg icon with freecad.svg from /freecad/src/Gui/icons) was not valid. So I replaced it with some other existing svg icon. No luck, it still won't work.
Then I thought, the script finds the mimetype, but the /etc/mime.types does not list it. So I add it to the file, annnnd... still nothing.
That's it, before I start banging my head on the wall for such a stupid thing, I think I'm gonna give up and forget all about it.
I found this page which uses a python script to get info on a file: https://help.ubuntu.com/community/Pytho ... /MIMETypes
With this script, I was able to determine the actual freecad document mime type:
Code: Select all
File type: application/x-extension-fcstd
Default Application: FreeCAD
Other Applications:
FreeCAD (Command: /usr/bin/freecad )
FreeCAD (Command: /usr/bin/freecad )
Description: FreeCAD document files
I named it application-x-extension-fcstd.svg and copied it in two places:
/usr/share/icons/gnome/scalable/mimetypes
/usr/share/icons/Humanity/mimes/48 (which seems to host most of the icons on Ubuntu Lucid)
Logged off for the umpteenth time, logged in... still no custom icon. I though, maybe my svg (made from merging with Inkscape an existing text document svg icon with freecad.svg from /freecad/src/Gui/icons) was not valid. So I replaced it with some other existing svg icon. No luck, it still won't work.
Then I thought, the script finds the mimetype, but the /etc/mime.types does not list it. So I add it to the file, annnnd... still nothing.
That's it, before I start banging my head on the wall for such a stupid thing, I think I'm gonna give up and forget all about it.

Re: FreeCAD document icon
I know, I was supposed to give up.
I just realized the mimetype was shown in the properties of a fcstd file, doh!
There's an x-extension-fcstd.xml file in /usr/share/mime/application, but this files doesn't include icon info. None of the other xml files do so...

I just realized the mimetype was shown in the properties of a fcstd file, doh!

There's an x-extension-fcstd.xml file in /usr/share/mime/application, but this files doesn't include icon info. None of the other xml files do so...
Re: FreeCAD document icon
... Resuming my monologue
Yeah, you must think I'm crazy to waste so much time on such an insignificant thing as icons. But that's me, if there's one thing I hate, it's having my computer get the best of me.
So I did some more digging, and unexpectedly, I found the solution with... a Gui tool. (link)
I installed the assogiate package, which is launched with the Applications > System Tools > File Types Editor menu, and was able to set a default icon for fcstd documents. I also added the FCStd extension.
Boy am I glad this is over!

Yeah, you must think I'm crazy to waste so much time on such an insignificant thing as icons. But that's me, if there's one thing I hate, it's having my computer get the best of me.

So I did some more digging, and unexpectedly, I found the solution with... a Gui tool. (link)
I installed the assogiate package, which is launched with the Applications > System Tools > File Types Editor menu, and was able to set a default icon for fcstd documents. I also added the FCStd extension.
Boy am I glad this is over!

Re: FreeCAD document icon
What you're actually looking for is a so called thumbnailer. For FreeCAD we have implemented this quite some time ago but it's not used at the moment. Have a look into the mime directory of the debian directory. I again have to check how to re-activate this again...
Re: FreeCAD document icon
Actually the thumbnailer used to work perfectly for me until the last update of Thunar... But my other thumbnailers (pdf, etc...) don't work anymore either...
Re: FreeCAD document icon
Hm refreshed the whole stuff, other thumbnailers now work correctly, only freecad doesn't... Must be some little thing that changed.
@Normand, you can also install a mime icon file by just putting it in ~/.icons
@Normand, you can also install a mime icon file by just putting it in ~/.icons
Re: FreeCAD document icon
Im not quit sure we mixing things up at the moment.
There are two things. One the FreeCAD icon shown in a file explorer which rest on a .fcstd file. The other is the
thumb-nailer which Werner mentioned. This piece of software (a ActivX control in Windows) retrieve a presaved
picture of the parts in the FreeCAD project file and shows it in the explorer. Very nice if you brows through
lots of files in the explorer. You recognize very intuitive the thing you looking for...
Both concepts have actually nothing to do with FreeCAD itself. Its mostly about the packaging and the used
Desktop environment. Under Windows its easy, the Windows explorer retrieves the Icon from the .exe and
shows accociated files with this Icon. For the thumb-nailer exists a interface and a ActiveX control (which Werner programmed) which gets
registered in the registry. Every time you switch in Windows explorer to the thumbnail view the control get called
and retrieve the thumbnail picture out of the .fcstd file (its embeded in the zip).
For Linux now I have no idea if there is a standard way for the different desktops (KDE, Gnome, ....) to
handle file icons and thumbnail plugins. Especially the thumb-nailer (as software) will be highly dependent
on the Desktop and its libraries....
There are two things. One the FreeCAD icon shown in a file explorer which rest on a .fcstd file. The other is the
thumb-nailer which Werner mentioned. This piece of software (a ActivX control in Windows) retrieve a presaved
picture of the parts in the FreeCAD project file and shows it in the explorer. Very nice if you brows through
lots of files in the explorer. You recognize very intuitive the thing you looking for...
Both concepts have actually nothing to do with FreeCAD itself. Its mostly about the packaging and the used
Desktop environment. Under Windows its easy, the Windows explorer retrieves the Icon from the .exe and
shows accociated files with this Icon. For the thumb-nailer exists a interface and a ActiveX control (which Werner programmed) which gets
registered in the registry. Every time you switch in Windows explorer to the thumbnail view the control get called
and retrieve the thumbnail picture out of the .fcstd file (its embeded in the zip).
For Linux now I have no idea if there is a standard way for the different desktops (KDE, Gnome, ....) to
handle file icons and thumbnail plugins. Especially the thumb-nailer (as software) will be highly dependent
on the Desktop and its libraries....
Stop whining - start coding!