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

Open attachment with a custom command like xdg-open #1494

Open
pacien opened this issue Apr 16, 2020 · 5 comments · May be fixed by #1505
Open

Open attachment with a custom command like xdg-open #1494

pacien opened this issue Apr 16, 2020 · 5 comments · May be fixed by #1505

Comments

@pacien
Copy link
Contributor

pacien commented Apr 16, 2020

Is your feature request related to a problem? Please describe.

It'd be nice to let xdg-open decide which application should be used when opening some attachment in alot.

Currently, alot only tries to use the ~/.mailcap mapping, which has to be manually kept in sync with other MIME databases (mimeapps.list, desktop entries, …).

Describe the solution you'd like

An option could be added to delegate the application choice to another program, such as xdg-open.

Describe alternatives you've considered

It's not possible to add a global fallback in .mailcap such as */*; xdg-open "%s" because */* isn't a valid wildcard as per RFC1524 and isn't accepted by the Python lib.

Additional context

Since b1c93c4, having text/*; xdg-open "%s" in .mailcap causes all text messages, not only attachments, to be opened externally. It's not possible to keep that entry to open log files attachments for instance.

@pazz
Copy link
Owner

pazz commented May 6, 2020

Agreed.
The (relatively simple) solution to add this feature would be to let
alot.commands.thread.OpenAttachmentCommand accept a string parameter that will be used as handler_command.. PRs would be much appreciated.

@pacien
Copy link
Contributor Author

pacien commented May 8, 2020

I can add such command but currently opening attachments is done by the "select" command, which allows the use of the same keybinding to perform this action and others. Is it possible to bind the same key a new OpenAttachmentCommand?

@pazz
Copy link
Owner

pazz commented May 8, 2020 via email

@pacien
Copy link
Contributor Author

pacien commented May 8, 2020

But it would be weird to have two commands doing the same thing in some cases.
Maybe should that command argument be added to the "select" command, but it wouldn't make sense when the focused element is not an attachment.

@pacien
Copy link
Contributor Author

pacien commented May 8, 2020

Nevermind, it actually makes sense to have another command, similar to "pipeto". I'll prepare a patch for this.

pacien added a commit to pacien/alot that referenced this issue May 9, 2020
This allows the user to open an attachment file with a program of their choice.

GitHub: closes pazz#1494
@pacien pacien linked a pull request May 9, 2020 that will close this issue
pacien added a commit to pacien/alot that referenced this issue May 9, 2020
This allows the user to open an attachment file with a program of their choice.

GitHub: closes pazz#1494
pacien added a commit to pacien/alot that referenced this issue May 9, 2020
This allows the user to open an attachment file with a program of their choice.

GitHub: closes pazz#1494
pacien added a commit to pacien/alot that referenced this issue May 9, 2020
This allows the user to open an attachment file with a program of their choice.

GitHub: closes pazz#1494
pacien added a commit to pacien/alot that referenced this issue May 9, 2020
This allows the user to open an attachment file with a program of their choice.

GitHub: closes pazz#1494
pacien added a commit to pacien/alot that referenced this issue May 9, 2020
This allows the user to open an attachment file with a program of their choice.

GitHub: closes pazz#1494
pacien added a commit to pacien/alot that referenced this issue May 9, 2020
This allows the user to open an attachment file with a program of their choice.

GitHub: closes pazz#1494
pacien added a commit to pacien/alot that referenced this issue May 9, 2020
This allows the user to open an attachment file with a program of their choice.

GitHub: closes pazz#1494
pacien added a commit to pacien/alot that referenced this issue May 9, 2020
This allows the user to open an attachment file with a program of their choice.

GitHub: closes pazz#1494
pacien added a commit to pacien/alot that referenced this issue May 10, 2020
This allows the user to open an attachment file with a program of their choice.

GitHub: closes pazz#1494
pacien added a commit to pacien/alot that referenced this issue May 10, 2020
This allows the user to open an attachment file with a program of their choice.

GitHub: closes pazz#1494
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

Successfully merging a pull request may close this issue.

2 participants