Hi guys,
This is my first post here. After following the troubleshooting on the manual, I can watch youtube videos on Nyxt
Sometimes, I like to watch them at 3x or 4x speed. This is not a youtube feature. It is more like a hack.
In Firefox, I achieve this with the following command on the browser’s console:
document.querySelector("video").playbackRate =3
I guess it is feasible to do something similar using Nyxt’s bookmarklets! This article was an inspiration for me.
I think I am close to do my first nyxt hacking. But I am stuck and would like to ask for your help.
This is what I did so far:
1 - After following the developer manual (git cloning, fetching, pulling, installing dependencies, et cetera), I am able to run the current master branch of Nyxt locally while doing some live coding.
2 - With Emacs and Sly (a fork from Slime), I am able to run Nyxt and use the REPL. This gives me live coding capability which I am trying to explore more.
3 - I did the following:
; SLY 1.0.43 (#<MREPL mrepl-1-1>)
CL-USER> (require :asdf)
NIL
CL-USER> (asdf:load-asd "/home/pedro/common-lisp/nyxt/nyxt.asd")
#<ASDF/FIND-SYSTEM:DEFINE-OP >
#<ASDF/PLAN:SEQUENTIAL-PLAN {100331D9F3}>
CL-USER> (ql:quickload :nyxt/gi-gtk)
To load "nyxt/gi-gtk":
Load 1 ASDF system:
nyxt/gi-gtk
; Loading "nyxt/gi-gtk"
.....................................
(:NYXT/GI-GTK)
CL-USER> (nyxt:start)
<INFO> [20:03:30] Listening to socket "/run/user/1000/nyxt/nyxt.socket".
Nyxt version 2.0.0-9-g5fdabca9
<INFO> [20:03:30] Loading Lisp file "/home/pedro/.config/nyxt/auto-config.lisp".
NIL
Then, I used the define-bookmarklet-command
in the REPL to insert the appropriate JS with:
CL-USER> (nyxt:define-bookmarklet-command hack-youtube-speed "Change youtube videos speed beyond 3x" "(function() { const rate = prompt('Set the new playback rate', 2.5); if (rate != null) { const video = document.getElementsByTagName('video')[0]; video.playbackRate = parseFloat(rate); } })();")
Apparently, I am reaching what I want since I got:
(#<NYXT:COMMAND HACK-YOUTUBE-SPEED {1003B8C5FB}>
#<NYXT:COMMAND NYXT-INIT-TIME {1002B8E10B}>
#<NYXT:COMMAND LOAD-INIT-FILE {1002B8E12B}>
...
.
.
.
#<NYXT:COMMAND MAKE-BUFFER {1002B902AB}> #<NYXT:COMMAND NOOP {1002B902CB}>)
As you can see, the bookmarklet that I created is now one of the elements of the bookmarklets’ list. Notice the first element on the list above.
Finally, this is the point that I am struggling with.
When I go to the GUI, after pressing M-x
, I cannot see my bookmarklet as one of the options. I just see the built-in ones. Apparently, my hack did not work for some reason. It is only in the REPL’s evaluation.
Thus, I decided to try to overcome the GUI failure with the REPL. I tried:
CL-USER> (nyxt: hack-youtube-speed)
CL-USER> (hack-youtube-speed)
Unfortunately, it did not work too. I just receive error messages from the compiler.
Actually, I am unable to use the REPL to set some of the commands. It goes beyond my bookmarklet function call.
I noticed this problem while trying to mimic the commands done by Pierre on this presentation. When I tried to replicate the commands on my environment they did not work.
He did this presentation something like 15 months ago. Maybe things changed. The project’s name changed for instance.
Exactly the same does not work for me:
CL-USER> (set-url “https://ambrevar.xyz”)
Slightly changing it also does not work:
CL-USER> (nyxt:set-url “https://ambrevar.xyz”)
In Pierre’s PC, it is not CL-USER but NEXT (Nyxt’s old name). Not sure if this is the key point or just a name. I am new to Common Lisp, Emacs, Slime/Sly, and et cetera…
Awkwardly enough, this works:
CL-USER> (nyxt:current-buffer)
#<NYXT:USER-WEB-BUFFER {1001A59193}>
Do you guys see what I am missing?
I am really excited about Nyxt!
Thanks for your attention.