IgnorantGuru / spacefm

SpaceFM File Manager
http://ignorantguru.github.com/spacefm/
GNU General Public License v3.0
489 stars 73 forks source link

Cairo Dock and SpaceFM .desktop files #163

Closed precutcolours closed 12 years ago

precutcolours commented 12 years ago

Wonderful app; my new fave. Never liked PCManFM, but must say: VERY well done! You outperform emelfm2 and 4Pane.

The issue concerns .desktop files. OS is freshly installed Arch Linux with OpenBox.

Bug:

Cairo Dock desklets open SpaceFM's "find" dialog, not SpaceFM's regular file manager.

Workaround:

Delete files from stock SpaceFM install,

/usr/share/applications/spacefm-find.desktop /usr/share/applications/spacefm-folder-handler.desktop

Saga:

First I tried MIME, XDG, and GNOME tweakers, StartPaged everywhere, going crazy to find my "default file manager" according to Hoyle. I set keys in registryish apps and tools, trying to follow everyone's advice, but Cairo would not behave. Somehow, it knew to use SpaceFM (good), but the wrong way (bad).

Then I invoked the stupidity axiom. What does a braindead developer do.

I terminaled myself into /usr/share/applications to grep "inode" -- and found, sure enough, the only results are SpaceFM .desktop files.

That explains Cairo's use of SpaceFM. Strangely I think, because I have other file managers (emelfm2).

Next, I list SpaceFM's .desktop files in sort order. The main file manager app comes last. The search app comes first. That fact explains why Cairo Dock uses it.

Somewhere in the universe of Arch-XDG-GNOME-MIME-SpaceFM-Cairo, somebody greps .desktop files and uses the first inode hit. Dunno how all this fits in the scheme of the universe, but the answer works for me. Cairo Dock behaves now.

I use unconventional XDG variables, but they are valid directories. A lot of apps fail to read/use these vars as they should. I do not have the full GNOME, just the bare mud that your typical OpenBox rig drags into the house.

IgnorantGuru commented 12 years ago

Thanks for your feedback. I'm not familiar with Cairo Dock, so just some general info. When installed spacefm adds those desktop files which basically adds spacefm the file manager, spacefm the file search window, and spacefm the folder handler as apps which handle mime type inode/directory (the new name for the now deprecated x-directory). This tells mime-aware apps on your system that these programs are available to open a directory. It does not specify which is the default (default apps are generally chosen by the user using a mime editor). The folder handler also sets NoDisplay=true, so it generally won't be displayed in your apps menu.

So it sounds like you need to set spacefm.desktop as the default app to open type inode/directory. Then Cairo Dock will probably use it. This can be done by editing mimeapps.list in ~/.local/share/applications. Or some apps still use the older defaults.list for this. (The mime spec for setting default apps recently changed and is not finalized, so there is inconsistency in how this is handled by apps - spacefm uses the new spec.) You can read about some of these details here. Or the spec, but note that some apps don't yet use mimeapps.list properly.

precutcolours commented 12 years ago

So I first thought, as explained. I did that advice; nothing helped.

I encourage SpaceFM and Cairo Dock to communicate over FreeDesktop standards.

Cairo Dock is extremely popular, the main desktop panel at Ubuntu, I believe? It did know to use SpaceFM somehow. It just didn't know what to do with 3 desktop files, I suspect. So it simply picked the first one found.

SpaceFM is the only app I've ever seen install 3 desktop files, or even 2.

The easy, quick answer is to rename SpaceFM .desktop files to file-name-sort the main .desktop first.

Then ask FreeDesktop folks whether 3 .desktop files is kosher, and if so, talk to Cairo about the way it handles them. The first order of business is to determine whether 3 .desktop files for one app is even legit.

Thanks again for this incredible, lightweight app.

IgnorantGuru commented 12 years ago

This isn't a problem in spacefm - nothing wrong with multiple desktop files when an app has different modes, such as spacefm's file search. You'll need to either research how to tell Cairo Dock which app (desktop file) to use as a default, or report a bug with them.

precutcolours commented 12 years ago

Regardless; please rename SpaceFM's desktop files so they file-sort the main app first. Then nobody need change a thing, or argue correct protocol.

As for multi-desktop files as valid protocol, supply a citation to FreeDesktop or any third-party app example(s). Otherwise we are just hand-waving. SpaceFM is the only app I've seen doing it, but I am open to education on the matter.

IgnorantGuru commented 12 years ago

If Cairo Dock is using the alphabetical order of the desktop files themselves to determine anything, this behavior is downright silly. Except for not conflicting with other apps, desktop filenames are arbitrary. I won't spend time accommodating such behavior (which is just as likely to change again next week, and which you may merely be misinterpreting as alphabetical).

Lots of apps use multiple desktop files. One example is libreoffice. It has at least three:

libreoffice-calc.desktop

Exec=libreoffice --calc %U

libreoffice-startcenter.desktop

Exec=libreoffice %U

libreoffice-writer.desktop

Exec=libreoffice --writer %U

As with spacefm's example, the same executable is being run with differing options to run it in different modes, and sorting the desktop files by filename is meaningless as startcenter is the most general invocation mode of the app.

In the unlikely case that Cairo Dock doesn't provide some mechanism or honor some spec for defining a default app, you can place copies of desktop files in ~/.local/share/applications and name them whatever you like. By placing them in this location, package upgrades shouldn't affect them, and any freedesktop-compliant app should look there before /usr/share/applications. (You may need to update the desktop cache after changing the names.) This is the correct way to customize desktop files (and their contents) for whatever reason.

VastOne commented 12 years ago

^ I have used Cairo-Dock for years and have never run into the issues that precutcolurs is bringing up. As you have correctly guessed, Cairo-Dock is highly customizable, on the same level as Xfce with the .desktop functions.

The issues stated are not a SpaceFM problem at all.