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

DownloadPost autocommand #807

Open
noctuid opened this issue Jul 14, 2018 · 4 comments · May be fixed by #4660
Open

DownloadPost autocommand #807

noctuid opened this issue Jul 14, 2018 · 4 comments · May be fixed by #4660

Comments

@noctuid
Copy link
Contributor

noctuid commented Jul 14, 2018

Pentadactyl has an event for after something has been downloaded. This particularly useful to pass the file location to a shell script and then open a vim-like file manager (e.g. ranger) to choose a new location for the file.

@antonva
Copy link
Member

antonva commented Jul 14, 2018

I'm definitely not opposed to this idea, the API doesn't provide a clear way to do this though. We do have the onChanged event though, maybe that fires when the download is finished?

@noctuid
Copy link
Contributor Author

noctuid commented Jul 15, 2018

The example on the bottom of that pages seems to be how you would check if the download is completed. It looks like the data for the filename and url are available as well.

@antonva
Copy link
Member

antonva commented Jul 15, 2018

You are correct. I didn't look at the delta object offered. This is definitely doable.

@glacambre
Copy link
Member

The betas have a :saveas command which accepts arbitrary paths (e.g. /tmp or ~/documents). It's not a proper downloadpost autocommand but it'll let you move stuff around.

antonva added a commit to antonva/tridactyl that referenced this issue Apr 23, 2019
This addresses issues tridactyl#810 and tridactyl#807. An optional argument of the type
AutocmdArgs can be passed to loadaucmds. Only a small subset of the variables
mentioned in tridactyl#810 are implemented. I think it's better to implement these as the
need/request arrives but for the DownloadPost aucmd I felt like this was the
most straightforward way to implement.

The parseaucmdargs function takes an aucmd and looks for the pattern "<param">
where param is any of the keys provided by AutocmdArgs and replaces the pattern
with the matching information from the args.

Example usage:
`:au DownloadPost .* fillcmdline "<file>"`
Will print the full path of the downloaded file on the cmdline.
antonva added a commit to antonva/tridactyl that referenced this issue Apr 23, 2019
This addresses issues tridactyl#810 and tridactyl#807. An optional argument of the type
AutocmdArgs can be passed to loadaucmds. Only a small subset of the variables
mentioned in tridactyl#810 are implemented. I think it's better to implement these as the
need/request arrives but for the DownloadPost aucmd I felt like this was the
most straightforward way to implement.

The parseaucmdargs function takes an aucmd and looks for the pattern "<param">
where param is any of the keys provided by AutocmdArgs and replaces the pattern
with the matching information from the args.

Example usage:
`:au DownloadPost .* fillcmdline "<file>"`
Will print the full path of the downloaded file on the cmdline.
@bovine3dom bovine3dom linked a pull request Apr 8, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants