Open jasonmhite opened 10 years ago
Hi, I also use ranger as a file viewer, and I agree using it to select the attachment could be great. It could be great to select multiples files at once, and also preview attachment files.
Guillaume.
I would absolutely love to see this.
Just today I sent my mum a bunch of pictures, and I hated every moment of it.
Has there been any work done?
Has there been any work done?
@mkaito Not on my side
Beside the subject seems quite huge in term of work to be done I think it is one of the 'hardest' point of selecting attachment in a console MUA such alot (same problem for mutt), we need to check what are the solution used elsewhere (mutt, sup).
In other way, it could be also solved by adding a frame buffer image support inside alot, I am not sure how it can be done, but if we can do it in w3m it could probably be done.
For the full thing, I think using Ranger is our best bet. It can be used as a file picker and can do image preview. It prints chosen files to stdout, so we'd need to invoke it, and then parse the output.
w3m just dumps text from the HTML source, so that's not a good example. IIRC, urwid (our toolkit) can embed external applications in internal frames, or if ranger can dump the filenames back to alot, you could open ranger over alot like we do with the editor, and and just read back what ranger tells you.
That's pretty much exactly how it works. Ranger dumps selected file names to stdoud on exit. You can call it exactly how you'd call a terminal based editor. Run, wait for it to exit, and parse its stdout.
Currently, I find the dialog for choosing files for attachments to be a bit lacking. Well, really it's pretty good and the completion is nice, but I'd like to have the option to have an external file selector.
Ranger already implements something similar for Vim. I'm going to work on making something similar for Alot, because I think those two fit together nicely.
In terms of implementation, I think the way to go about it is to make it another class for
ExternalAttachCommand
that behaves likeEditCommand
. Only thing is, it takes some extra interface code to process the output from a given file selection program that the user needs to write for whichever program they want to use. I'm not quite sure of the best way to handle this given the way Alot handles spawning external processes.Other thoughts/comments/objections?