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

"handlr list" doesn't fully describe decision making process. make it clearer what assumed prior knowledge is? #20

Open
Dieterbe opened this issue Oct 4, 2020 · 5 comments

Comments

@Dieterbe
Copy link

Dieterbe commented Oct 4, 2020

Hello,

my handlr list output is below

handlr list
┌─────────────────────────┬────────────────────────────────────┐
│ message/rfc822          │ userapp-Thunderbird-JHQ4UY.desktop │
│ x-scheme-handler/mailto │ userapp-Thunderbird-JHQ4UY.desktop │
│ x-scheme-handler/webcal │ chromium.desktop                   │
└─────────────────────────┴────────────────────────────────────┘

This seems incomplete. I know for example that a file with extention .txt will be opened by gvim (though I don't know why)
When I strace handr list i see it opens lots of .desktop files in .local/share/applications and /usr/share/applications/
From what I understand, there's also custom associations that can be set in handlr as well as a separate mimetype data base.
The readme mentions "Automatically removes invalid/wrong .desktop entries from mimeapps.list", I have these 3 files (see below) and it's not clear how they're used or in which priority order:

~/.config/mimeapps.list
~/.local/share/mimeapps.list
~/.local/share/applications/mimeapps.list

I know that part of the problem is that I'm uneducated on the matter, and i could probably go read the various (?) XDG/opendesktop specs that are relevant, but it seems rather confusing, so maybe there is an opportunity to steer new users in the right direction:

  • it's not even clear what is assumed prior knowledge before using this tool? perhaps the readme should link to the respective resources/specifications that I should study first?
  • the readme mentions Compared to xdg-utils, so this tool replace xdg-open and xdg-mime? if not, which ones exactly?
  • is there any quick wins that can be made to make handlr more userfriendly, and not require (as much) prior knowledge?
    for example handr list could give a more complete listing of all resources that it uses in its decision process. or how about something like handlr explain that says, for a given file, how it arrives at a decision?

thanks!

@chmln
Copy link
Owner

chmln commented Nov 7, 2020

@Dieterbe I've added --all to handlr list which will show all the associations, user and system :)

about something like handlr explain that says, for a given file, how it arrives at a decision?

Yeah I might add a verbose option to handlr get at some point. What do you think ?

@Dieterbe
Copy link
Author

Dieterbe commented Nov 9, 2020

handlr list --all is helpful, and the verbose flag sounds good. thank you!

FWIW, as a user it's not necessarily clear why certain associations exist (for example when i run the new handlr list --all i have "added associations" which seem to come from desktop files in /home/dieter/.local/share/applications/, but also from /usr/share/applications/, but confusingly other files from /usr/share/applications seem to go under "System Apps", not "added associations") a quick note about where the associations come from, maybe with a link to the relevant spec, would be really useful I think.

@chmln
Copy link
Owner

chmln commented Dec 19, 2020

@Dieterbe this feature is now released in v0.5 :)

@Dieterbe
Copy link
Author

Dieterbe commented Jan 17, 2021

So, which specs should one read to understand how this tool works?
I was reading the source and through https://crates.io/crates/freedesktop-desktop-entry I found out it uses the spec https://specifications.freedesktop.org/desktop-entry-spec/latest/index.html

which other ones ? https://www.freedesktop.org/wiki/Specifications/file-uri-spec/ ? https://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec/ ?
https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-1.0.1.html ?

so far, seems mime-apps-spec is the most relevant one. Again, some guidance to users of this tool about what they should know, would be very helpful.

edit: after some reverse engineering, it seems handlr follows what mime-apps-spec says, and uses the files mentioned there. associations are maintained in $XDG_CONFIG_HOME/mimeapps.list (even when set through handlr), and not in the handlr config file. sort of stuff would be very useful to document . some more things i found out, the "selector" to choose how to open is only in case you have multiple entries on the priority mimeapps config. it doesn't let you choose if you have different choices at different priority levels.

@chmln
Copy link
Owner

chmln commented Apr 23, 2021

@Dieterbe good points. If you wanna write up a quick paragraph to add it to the README I would really appreciate it

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

No branches or pull requests

2 participants