jun7 / wyeb

a vim-like webkit2gtk web browser
GNU General Public License v3.0
105 stars 6 forks source link

URI handlers don't trigger when clicking link from existing page #38

Open kqzkqz opened 4 years ago

kqzkqz commented 4 years ago

hi!

I'm playing around with some handler rules, and I have the following in my main.conf

[uri:^https://www.youtube.com/watch(.*)]
#handler cancels request before sent and
#spawns the command with a URI matched the 'uri:'
handler=mpv --profile=unpause --ytdl https://youtube.com/watch%s

this works perfectly if I start wyeb from the command line with a youtube video, but if I say, go to youtube.com and search for a video, then click on one, it doesn't trigger. (unless I reload the video after clicking on it)

is there anyway to change this behavior?

thanks!

jun7 commented 4 years ago

Probably the URI is changed by javascript without loading a page. You can see the progress bar is not rendered. wyeb checks uri settings when a page is loading. So reloading triggers it.

Hmm changing the URI handling is very heavy and supporting javascript's random behavior is difficult so much.

Currently If you don't want press key 'r' you could manage it by change of mdlbtnlinkaction(Middle button action on a link). May be

[uri:^https://www.youtube.com/]
mdlbtnlinkaction=sh mpv --profile=unpause --ytdl $LINK

and then middle click a link. or if you don't mind showing a video's page mdlbtndown=sh mpv --profile=unpause --ytdl $URI and after showing a video page, middle drag down.

Sorry the samples are not tested.

kqzkqz commented 4 years ago

thanks for the response, that makes sense, youtube is incredibly bloated with javascript so I figured something was happening there.

thanks for the workaround though! I think what I'm going to end up trying first is to use a lightweight youtube frontend like https://invidio.us and have my handler open mpv with that URI, and eventually just disable javascript in wyeb all together once I have other sites working like twitch.