Le 04/08/2022 à 23:28, Steve M a écrit :
Ludovic,

Timeshift first uses xdg-open to call the default tool of your desktop
environment as it in turn calls gvfs-open, kde-open, exo-open, gnome-
open, etc. as appropriate. On my Debian desktop with KDE running xdg-
open and kde-open launche Dolphin, but on my Pop_OS laptop xdg_open is
not installed and there is no gvfs-open for some reason.

In the event that xdg_open fails, Timeshift tries in order to launch
nemo, nautilus, thunar, io.elementary.files, pantheon-files, marlin,
and dolphin lastly.

In your case it seems that maybe xdg-open is resulting in "code" being
called due to your Gnome settings. The command `xdg-mime query default
inode/directory` should report out what the default file browser is set
to. You can also look in ~/.config/mimeapps.list to see what it is set
to. I think you can just edit this file or run a command similar to
`xdg-mime default org.gnome.Nautilus.desktop inode/directory` to make a
change.

Please let me know how this works out as it may be worth asking
upstream for a more robust means of opening the default file manager.

Thanks
-Steve

Steeve,

Okay. I see the catch!

The command `xdg-mime query default inode/directory` returns
org.gnome.Nautilus.desktop (as expected) when I run it as my user.

But, as Timeshift runs as root, if I run the same xdg-mime command as
root I get `code.desktop` :(

root doesn't have any `~/.config/mimeapps.list file`. And it sure won't
use the settings I have in my account.
After purging the VSCode package, the xdg-mime returns
org.gnome.Nautilus.desktop as one would expect.

As root, `xdg-mime default org.gnome.Nautilus.desktop inode/directory`
creates the cat ~/.config/mimeapps.list enforcing nautilus as the
default application. Fixing the behaviour when VSCode is installed.


A diff of my /etc folder after VSCode install show this change brought
by the package. Adding VSCode for inode/directory if I understand it
properly :

```
diff --git a/mailcap b/mailcap
index 7167022..2d64e78 100644
--- a/mailcap
+++ b/mailcap
@@ -84,6 +84,10 @@ application/xhtml_xml; /usr/bin/chromium %s; test=test -n 
"$DISPLAY"
 application/x-mimearchive; /usr/bin/chromium %s; test=test -n "$DISPLAY"
 x-scheme-handler/http; /usr/bin/chromium %s; test=test -n "$DISPLAY"
 x-scheme-handler/https; /usr/bin/chromium %s; test=test -n "$DISPLAY"
+x-scheme-handler/vscode; /usr/share/code/code --open-url %s; test=test -n 
"$DISPLAY"
+text/plain; /usr/share/code/code --new-window %s; test=test -n "$DISPLAY"
+inode/directory; /usr/share/code/code --new-window %s; test=test -n "$DISPLAY"
+application/x-code-workspace; /usr/share/code/code --new-window %s; test=test -n 
"$DISPLAY"
 application/vnd.iccprofile; /usr/bin/gcm-import %s; test=test -n "$DISPLAY"
 application/pkcs12; /usr/bin/gcr-viewer %s; test=test -n "$DISPLAY"
 application/pkcs12+pem; /usr/bin/gcr-viewer %s; test=test -n "$DISPLAY"
```

So, I guess that Timeshift does it right. And it's VSCode causing trouble to 
the party.

--
Ludovic Poujol

Reply via email to