Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GNOME Nautilus does not recognize the .FCStd extension anymore (AppImage) #265

Open
2 tasks done
leoheck opened this issue Jul 5, 2024 · 33 comments
Open
2 tasks done
Assignees

Comments

@leoheck
Copy link
Contributor

leoheck commented Jul 5, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Problem description

Nautilus does not know the FCStd extension anymore.

image

Full version info

OS: Ubuntu 24.04 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.38001 (Git) AppImage
Build type: Release
Branch: main
Hash: 1fc6da959b936a2999774a4fe5b4c4b12bf6ac8d
Python 3.11.9, Qt 5.15.13, Coin 4.0.2, Vtk 9.2.6, OCC 7.7.2
Locale: English/United States (en_US)
Installed mods: 
  * POV-Ray-Rendering
  * Assembly4 0.50.12
  * InventorLoader 1.4.0
  * ose-piping
  * OpenTheme 2024.7.3
  * SheetMetal 0.4.20
  * fasteners 0.5.24
  * asm4_disable_version_check_popup
  * Render 2024.7.4
  * OpticsWorkbench 1.0.18
  * lattice2 1.0.0
  * kicadStepUpMod

Subproject(s) affected?

None

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@adrianinsaval
Copy link
Member

sounds like a nautilus issue not a freecad issue. The appimage doesn't register file associations

@luzpaz
Copy link
Collaborator

luzpaz commented Jul 5, 2024

Is there an upstream ticket ?

@adrianinsaval
Copy link
Member

could also be something coming from appimagelauncher, if we had more details about what's the mechanism at play here we could see if there's something we can do on our end

@leoheck
Copy link
Contributor Author

leoheck commented Jul 6, 2024

this is a regression.

@adrianinsaval
Copy link
Member

how was it before? what registered fcstd files and how? I can't do anything if you don't give me information. Like I said before this is not stuff we are doing ourselves.

@leoheck
Copy link
Contributor Author

leoheck commented Jul 6, 2024

I can give extra information, I just don't know what do you need as information.

Before, it used to display the Freecad icon on .FCStd files. Also, .FCbak could have a defined icon.

Perhaps this issue belongs to the Freecad-Bundle instead. The regression may be introduced when the new logo was launched. But I am not sure.

@maxwxyz
Copy link
Collaborator

maxwxyz commented Jul 6, 2024

Do you have the stable version installed too or had it in the past?

@leoheck
Copy link
Contributor Author

leoheck commented Jul 6, 2024

had it installed some weeks ago.

@furgo16
Copy link

furgo16 commented Jul 6, 2024

In case it helps: https://askubuntu.com/questions/1421738/nautilus-changing-a-file-icon-from-command-line

Could you try running this command (replacing SomeFreeCADFile.FCStd)? Ideally before and after the change:

gio info -a "metadata::custom-icon" SomeFreeCADFile.FCStd

Is this something that the .deb package from the PPA used to do perhaps?

@furgo16
Copy link

furgo16 commented Jul 6, 2024

The FreeCAD package from the Ubuntu archives ships the custom icon: https://packages.ubuntu.com/jammy/all/freecad-common/filelist. Around the end of the list, see:

/usr/share/freecad/share/icons/hicolor/scalable/mimetypes/application-x-extension-fcstd.svg

The FreeCAD daily PPA package does as well:

dpkg -L freecad-daily-common | grep x-extension-fcstd
/usr/share/freecad-daily/share/icons/hicolor/scalable/mimetypes/application-x-extension-fcstd.svg

And the FreeCAD daily snap as well:

ls -lR /snap/freecad/current/ | grep -B 3 x-extension-fcstd

/snap/freecad/current/usr/share/icons/hicolor/scalable/mimetypes:
total 5
-rw-r--r-- 1 root root 4709 Jul  5 02:47 application-x-extension-fcstd.svg

application-x-extension-fcstd

@furgo16
Copy link

furgo16 commented Jul 6, 2024

I can also reproduce it, but I think it's a package-specific bug, and not a FreeCAD (the app) one.

In summary, I think:

  • The custom icon is shipped on installable packages. I'm not familiar enough with AppImage to tell if it's something it also does or should do.
  • The shipped custom icon has the right FreeCAD logo
  • The shipped custom icon is failing to register with the .FCStd extension

This applies to .snap and .deb packages, as the issue description hints at the host system being Ubuntu.

@Carpetner

This comment was marked as off-topic.

@leoheck

This comment was marked as off-topic.

@nazar-pc
Copy link

nazar-pc commented Jul 8, 2024

This is packaging-related issue that AppImage can't solve directly since it is not installed, but FreeCAD can hypothetically add a menu entry that would automate described below for those using AppImage (only updates, at least for dev builds, will be problematic due to unique name used for downloaded file rather than replacing existing file instead).

Basically to fix this you need to do the following steps.

Create desktop shortcut for FreeCAD

Create file ~/.local/share/applications/freecad.desktop (and necessary directories if they don't exist) with following contents:

[Desktop Entry]
Version=1.0
Type=Application
Name=FreeCAD
Icon=freecad
Exec="/home/user/.local/bin/FreeCAD.AppImage" %f
Terminal=false

/home/user/.local/bin/FreeCAD.AppImage should point to your downloaded AppImage.

Now you'll see FreeCAD among installed apps and will be able to launch it like anything else.

Register mime type

For FreeCAD files to be recognized as something other than simply a ZIP file, separate mime type association needs to be created.

Create file ~/.local/share/mime/packages/org.freecadweb.FreeCAD.xml (and necessary directories if they don't exist) with following contents (mostly taken from freecad-common file of old Ubuntu package):

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
  <mime-type type="application/x-extension-fcstd">
    <!-- <sub-class-of type="application/zip"/> -->
    <comment>FreeCAD document files</comment>
    <glob pattern="*.fcstd"/>
    <glob pattern="*.fcbak"/>
    <icon name="org.freecadweb.FreeCAD"/>
  </mime-type>
</mime-info>

And update mime database:

update-mime-database ~/.local/share/mime

Now FreeCAD files will be recognized as a separate type and assuing the theme you're using has icons, you will get a dedicated icon for those files as well (I use Numix Circle theme and it does have icon for FreeCAD) or you may have to place one at ~/.local/share/icons/hicolor/scalable/apps/freecad.svg.

Create association between FreeCAD and new type of files.

Simpy try to open the file with file manager (Nautilus, Nemo, etc.), choose FreeCAD from the list of apps and click "Set as default" to open this file type with FreeCAD going forward. Physically this will add application/x-extension-fcstd=freecad.desktop line to both [Default Applications] and [Added Associations] sections of ~/.config/mimeapps.list file.

@leoheck
Copy link
Contributor Author

leoheck commented Jul 8, 2024

I use the AppImageLauncher which does this for us.

Here is the comment from the Author
TheAssassin/AppImageLauncher#275 (comment)

This is his first sentence:

File associations are supported and work fine. There are some prominent examples like FreeCAD or Ultimaker Cura (which even supports STL files out of the box!) which demonstrate this.

This thing was working fine using the AppImageLauncher, now it does not work anymore for some reason.

@adrianinsaval
Copy link
Member

the desktop file we ship defines supported mimetypes https://github.com/FreeCAD/FreeCAD/blob/de508e437d13e7eb35baffceea496fb9107888cb/src/XDGData/org.freecad.FreeCAD.desktop#L24C10-L24C21 so I don't know what would be missing here.

@adrianinsaval adrianinsaval transferred this issue from FreeCAD/FreeCAD Jul 8, 2024
@luzpaz
Copy link
Collaborator

luzpaz commented Aug 27, 2024

We need a GNOME person to weigh-in

@leoheck
Copy link
Contributor Author

leoheck commented Aug 27, 2024

Freecad icons look like this for me.
image

For instance, these are Kicad icons and they look great.
image

I could help to fix this, but I am kinda running against clock to finish a project. And Freecad 0.22 is also giving all sorts of issues. If I can advance with my side project, I am going to explore how to fix this.

@luzpaz luzpaz changed the title Nautilus does not know the .FCStd extension anymore. GNOME Nautilus does not recognize the .FCStd extension anymore Aug 27, 2024
@luzpaz luzpaz added the bug label Aug 27, 2024
@luzpaz
Copy link
Collaborator

luzpaz commented Dec 11, 2024

Is this still a thing ?

@furgo16
Copy link

furgo16 commented Dec 11, 2024

I still see the generic (non-FreeCAD) icon as in #265 (comment). I'm using Ubuntu 22.04 on my laptop and the latest .snap and .deb daily packages.

@luzpaz
Copy link
Collaborator

luzpaz commented Dec 11, 2024

Opened an upstream discussion in the GNOME discourse forum: https://discourse.gnome.org/t/how-to-get-freecad-logo-associated-with-the-fcstd-file-extension-when-its-automagically-installed/25602

@luzpaz
Copy link
Collaborator

luzpaz commented Dec 16, 2024

@probonopd any insight on having AppImage + Nautilus recognize AppImage applications and associate their files to the application ?

@luzpaz luzpaz changed the title GNOME Nautilus does not recognize the .FCStd extension anymore GNOME Nautilus does not recognize the .FCStd extension anymore (AppImage) Dec 16, 2024
@probonopd
Copy link
Collaborator

Probably you would have to copy a .desktop file into $HOME that would associate the MIME type with the AppImage. But the whole .desktop file idea is not really well suitable for portable applications ("bundles") that can come and go (and be there in multiple versions). Imho the whole Linux XDG specifications need to be rethrought from scratch with bundles in mind, more like the Mac does it.

@adrianinsaval
Copy link
Member

I'm not in favor of automatic creation of desktop files by the appimage, presumably the reporter was using appimagelauncher though so a desktopfile should have been created, I guess the problem is that appimagelauncher does not copy over the document icon, only the app icon.

@leoheck
Copy link
Contributor Author

leoheck commented Dec 20, 2024

Exactly, and also another problem is that since some weeks ago the appimagelauncher is not working anymore which is really sad.

The Gear Lever sucks and also does not allow me to have 2 "installed" appimages of the same tool (for 1.0 and nightlies for instance). Or maybe this is still something that can be tweaked in the AppImage. But right now, installing one overrides the other. And also, the desktop file is named after the git commit which is horrible for the user to identify the version to decide which version they want to launch...

@luzpaz
Copy link
Collaborator

luzpaz commented Jan 4, 2025

2 responses from the forum:

File type associations are not maintained by GNOME: GNOME consumes the data in the shared-mime-info database.

It’s entirely possible that FreeCAD is shipping its own extensions to that database, which is allowed; but AppImage is a self-contained distribution format that does not interact with the system in any way (which is why it does not provide desktop files either, and requires manual installation of files by the user), so it’s unlikely that it’ll work for MIME type extensions, or icons.

My strong recommendation is to stop shipping AppImages, unless you’re also willing to document how to integrate them into a freedesktop system, something that the AppImage development community is wholly uninterested in doing, seeing as they are trying to replicate the macOS app deployment mechanism.

And

What is result of the following command

gio info -a "*" myfile.FCStd | grep icon

@luzpaz
Copy link
Collaborator

luzpaz commented Jan 5, 2025

gio info -a "*" myfile.FCStd | grep icon
Need a GNOME user to test this out.

@leoheck
Copy link
Contributor Author

leoheck commented Jan 5, 2025

Hi @luzpaz this is the output

➜ gio info -a "*" myfile.FCStd | grep icon

  standard::icon: application-x-extension-fcstd, application-x-extension-fcstd-symbolic
  standard::symbolic-icon: application-x-extension-fcstd-symbolic, application-x-extension-fcstd-symbolic, application-x-extension-fcstd

@AbuShawarib
Copy link

Can you see the icon if you change to hicolor icon theme?

@AbuShawarib
Copy link

AbuShawarib commented Jan 5, 2025

Pretty much what was said by nazar-pc and the quoted forum post. Linux XDG standards expects apps to install MIME types (if they are not registered in the general shared MIME DB) and that icons be installed in the usual theme paths. Both don't happen magically with appimages.

@adrianinsaval
Copy link
Member

I don't think this ever worked, if it did it was probably only by chance, I don't think appimagelauncher copies the doc icon, only the application icon.

@luzpaz
Copy link
Collaborator

luzpaz commented Jan 5, 2025

This did work because @leoheck custom made a logo for the FreeCAD Conda AppImages, IIRC

@adrianinsaval
Copy link
Member

I believe that was the app icon, not document icon. The app icon might have been used for documents but that's incorrect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants