amfora icon indicating copy to clipboard operation
amfora copied to clipboard

Ability to run user-defined actions/scripts

Open mntn-xyz opened this issue 4 years ago • 6 comments

It would be nice to have a hotkey or bar command to run a user-defined action with the argument being the current URL or the URL of a specific link #. For instance, I might want to append the URL to a text file, use Emacs org-capture to file the URL appropriately, compose a new email with the link in the message body, etc.

mntn-xyz avatar Oct 11 '21 03:10 mntn-xyz

Yeah that could be useful. But you can already copy the current URL to the clipboard with a command, so I'm not sure if this would really be worth it.

makew0rld avatar Oct 11 '21 16:10 makew0rld

True, I wouldn't consider it high priority, but it would save a couple of keystrokes each time, which can add up.

What led me to suggest this is that I like to manage bookmarks in orgmode, as I can annotate, categorize, and tag them appropriately. The bookmarks functionality in Amfora works well enough, but it isn't adequate for my needs. (Not a criticism of Amfora, by the way; Chrome's bookmarks functionality also isn't adequate from my perspective. I have too many bookmarks.)

mntn-xyz avatar Oct 11 '21 16:10 mntn-xyz

Fair enough. I'll leave this issue open but I can't say I plan on working on it any time soon.

makew0rld avatar Oct 11 '21 17:10 makew0rld

I came up with another use case. You could set up a hotkey to run a script that would generate a certificate for the current site and update the config file. Unfortunately you'd currently need to reload Amfora to get the updated config, but this could make certificate generation much quicker.

And a variation on what I mentioned before: you could run a script to append URLs to a file using a single keypress, for the purpose of quickly building a curated collection of URLs. When ready, you could then send this file through a script to generate an epub or pdf. (Or you could set up a second action that automatically builds the epub/pdf, emails it to your e-reader, and clears out the current curated list of files.) Lots of potential!

I may look at putting together a PR for this in the near future.

mntn-xyz avatar Oct 13 '21 15:10 mntn-xyz

Definitely some interesting uses there. A PR would be appreciated if the changes aren't too extensive and are documented. Thanks!

makew0rld avatar Oct 14 '21 16:10 makew0rld

Things I didn't add in the PR, but which I considered:

  • Automatic substitution of home directory path for ${home} in command path - while this may be useful it's just a nice to have
  • Running commands on a specific link from the command bar, like cmd1:15 to run command 1 on link 15. This could be useful in certain contexts, but honestly it's' not strictly necessary, and I expect people who use this heavily to rebind the keys anyway to sensible mnemonics like "Alt-E" for "email" or similar. In this case they would have to remember that "cmd5" or whatever corresponds to email.

mntn-xyz avatar Oct 16 '21 19:10 mntn-xyz