gdh1995/vimium-c

Integration with ff2mpv

arthsmn opened this issue ยท 7 comments

What command or commands

Add a feature to LinkHints

How should a feature do

When a user has done such steps:

  1. Press a keybinding to show the hints on links
  2. Choose a hint

then Vimium C should do:

  1. Send the link to ff2mpv or maybe open the link, execute ff2mpv in the new tab and then close it

Browser and OS

  • Browser name: Firefox 121.0.1
  • OS name: Linux 6.7.0 #1-NixOS SMP PREEMPT_DYNAMIC Sun Jan 7 20:18:38 UTC 2024

Um sorry it's impossible up to now, because ff2mpv doesn't expose such an interface to allow other extensions to activate it.

@gdh1995 now that woodruffw/ff2mpv#113 is merged could this be done?

Great! Then you may:

  1. add these to Custom key mappings:
map vvv LinkHints.activateOpenUrl sed="_ff2mpv"
map <v-ff2mpv> sendToExtension \
  id="ephjcajbkgplkjmelpglennepbpmdpjg" raw
  1. add these to Auto substitution of various text:
_ff2mpv@^@@,encode
_ff2mpv@^.*@vimium://run1/<v-ff2mpv>#data={"type":"openVideo","url":"$0"}@

Then LinkHints.activateOpenUrl will call sendToExtension with given id and a data of selected url.

====

BTW, in Vimium C v2.x, a simpler mapping will be:

map vvv LinkHints.activateOpenUrl keyword="ff2mpv"
map <v-ff2mpv> sendToExtension id="ephjcajbkgplkjmelpglennepbpmdpjg" raw

and

ff2mpv: vimium://run1/ff2mpv#data={"type":"openVideo","url":"$s"}

Great! Then you may:

1. add these to `Custom key mappings`:
map vvv LinkHints.activateOpenUrl sed="_ff2mpv"
map <v-ff2mpv> sendToExtension \
  id="ephjcajbkgplkjmelpglennepbpmdpjg" raw
2. add these to `Auto substitution of various text`:
_ff2mpv@^@@,encode
_ff2mpv@^.*@vimium://run1/<v-ff2mpv>#data={"type":"openVideo","url":"$0"}@

Then LinkHints.activateOpenUrl will call sendToExtension with given id and a data of selected url.

====

BTW, in Vimium C v2.x, a simpler mapping will be:

map vvv LinkHints.activateOpenUrl keyword="ff2mpv"
map <v-ff2mpv> sendToExtension id="ephjcajbkgplkjmelpglennepbpmdpjg" raw

and

ff2mpv: vimium://run1/ff2mpv#data={"type":"openVideo","url":"$s"}

This didn't work, sadly. It's saying that it couldn't establish connection. Using Vimium C version 1.99.997 and ff2mpv version 5.1.0.

Um, now that you're using Firefox, please replace the id="**********" with id="ff2mpv@yossarian.net"

Um, now that you're using Firefox, please replace the id="**********" with id="ff2mpv@yossarian.net"

It worked! Thanks for your help!

Can this be added to the Wiki? I think it'll make it easier to find.