Sample Header Ad - 728x90

Setting default file manager and locating a file with the default file manager

0 votes
1 answer
2579 views
Please don't mark it as duplicated before reading my question. I know that there already are those questions, but the existing answer did not work as expected, and that is why I am asking this question. Existing answers say that the way to set the default file manager is xdg-mime default inode/directory, and the way to locate a file with the default file manager is dbus-send --session --print-reply --dest=org.freedesktop.FileManager1 --type=method_call /org/freedesktop/FileManager1 org.freedesktop.FileManager1.ShowItems array:string:"" string:"". But when I tested this on a few Arch-based distributions including Arch with Gnome, the dbus-send command did not always open the file manager that the xdg-mime query default indicates, after installing Nemo file manager (Gnome's default file manager is Gnome Files). Whilst xdg-mime query default inode/directory outputs nemo.desktop, the dbus-send... command above opened Gnome Files, and when the former outputs "org.gnome.Nautilus.desktop", the latter opened Nemo. (This is when there is no running file manager. If there already is an instance of a file manager, dbus-send command seem to use that file manager.) Is the dbus-send command above is the right command to "locate a file with the default file manager"? Whilst the dbus-send above command did not work as expected, JetBrain's IDE's like Android Studio or IntellJ correctly located the file with the default file manager, when I right-clicked a file, and then click "Open in", and then the file manager's name. I thought of looking into their source code, but those are huge applications and trying to search [their source code](https://github.com/JetBrains/intellij-community) returned no result (I used keywords like "open in" or "file manager").
Asked by Damn Vegetables (1539 rep)
Apr 27, 2023, 03:26 PM
Last activity: Apr 30, 2023, 02:54 PM