Show in ... menu item
已回答
Running IDEA on Centos 7 and the Show In 'Explorer' menu item is showing as 'Show in Disk Usage Analyzer'? any idea why or how to correct it? think the shell is Nautilus, should it read Show in Shell? that's what it does, it doesn't open disk usage analyzer at all?
请先登录再写评论。
IntelliJ IDEA runs xdg-mime utility to find the associated file manager name.
See https://github.com/JetBrains/intellij-community/blob/master/platform/platform-impl/src/com/intellij/ide/actions/ShowFilePathAction.java#L97 for details.
hmm, if I turn debug on for that query I get this:
boabab is apparently the name for Disk Usage Analyzer.
Whats odd is all these defaults.list files it queries. None of these exist on centos 7, with rhel 7 the name of the mime files changed from defaults.list to mimeapps.list. But from the above it appears nobody told xdg about this change?
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/desktop_migration_and_administration_guide/file_formats
Other thing that's odd is right at the end it finds both org.gnome.boabab and org.gnome.Nautilus, but the former (incorrect) seems to win the lookup. why? I'm not sure how either of these matches are made, as I said from the debug output, none of the mime lookups should have returned anything due to the missing files. I'm left none-the-wiser.
xdg query also returns same result on another centos 7 server we created last week, but has not been installed as yet. So not just my machine.
Ok I think I might know whats going on, because all the mime type db files are 'missing' (so far as xdg is concerned) it delegates to looking through all the .desktop files and both
/usr/share/applications/org.gnome.baobab.desktop,
/usr/share/applications/org.gnome.Nautilus.desktop
Have inode/directory as their mime type, appears the first desktop file baobab wins?
Don't think the mimetypes are incorrect, directories are the default associations for both.
ugh open source desktops, seems issue(s) have been known about since 2012, gnome passed the buck - likely to never be fixed?
https://bugzilla.gnome.org/show_bug.cgi?id=687598
https://bugs.archlinux.org/task/31861
Does any of `mimeapps.list` files in your system contain the "[Default Applications]" section with "inode/directory=..." line in it?
Just for the record, on my Ubuntu/GNOME the query logs this:
Of these, I happen to have `~/.config/mimeapps.list` and `/usr/share/applications/defaults.list`, with the latter associating directories with Nautilus.
The latest spec definitely uses `mimeapps.list` and has zero mentions of `defaults.list`; GNOME reads both. If I got it right, the problem could be in a distro shipping outdated/misconfigured XDG utils, or in utils themselves not following their own spec.
BTW, how did you install the IDE? These Flatpak dirs in the query look suspicious.
Yes the default mimeapp.list in /usr/share/applications/ does assign inode/directory to org.gnome.Nautilus. Also baobab isn't mentioned at all in any of the mimeapp.list files. But there are no defaults.list files at all in any directory on CentoOS 7 (7.6). I'm assuming that's why it xdg-mime starts querying every .desktop file and how it finds baobab and Nautilus.
What I've done is edit the org.gnome.baobab.desktop file and remove the inode/directory MimeType entry (just commenting it out didn't work). So now the same query only returns Nautilus desktop file. IntelliJ IDEA now shows 'Show in Files' so I guess it didn't really need the shell name. Is a second or two delay when I right click to when the menu appears. Wasn't sure if it was the extended .desktop queries. Servers new to me, not sure what's normal in terms of performance.
Think the only thing I loose is being able to right click folders and open in disk usage analyser. But I can still launch it and drill down to the folders I'm interested in. It's better than having it appear incorrectly as the default shell (not just in idea). Seemed a safer 'fix' than symbolically linking mimeapps.list to defaults.list in every xdg query folder.
flatpak I know nothing about, didn't build the server our devops team do that. It was pretty sparse when I got got my hand on it, no frills. The other so far unused server I commissioned last week also shows same flatpak queries. Must either be part of the distro or our devops kickstarter build.
Sorry for the late reply.
With file associations, there are two rather different queries: (1) give me all programs able to open this file, and (2) give me the default program for opening this file. The first one is served from `mimeinfo.cache` files which are ultimately built from *.desktop files and should contain both Baobab and Nautilus. The second query is served from these `mimeapps.list`/`defaults.list` files and should tell which program is the preferred one - i.e. these files should list only Nautilus. The first query is used by Nautilus for the context (right-click) menu; the second one - by the IDE via `xdg-mime query default ...`.
To me, the problem seems to be that on that system the defaults are stored in `mimeapps.list`, but XDG utils are searching `defaults.list` - so symlinking the latter to the former and restoring the association in `baobab.desktop` should make the system to behave as desired.