Using remote & eval

Using set-url (C-l) usually hangs, I’ve setup a custom macro for stumpwm to search in a new buffer utilizing something like this shell command nyxt ''

Is there a way to use something like nyxt -r -e '(set-url "") to set a new url for the current buffer?

Try using buffer-load or set-url in a non-interactive way.

set-url is meant to be used interactively, unless you pass the url keyword, e.g. (set-url :url "").

1 Like

thanks! This works nicely, do you have any tips on improving the performance of nyxt? Is there a way to disable parts of the minibuffer functionality to reduce hangs/loading processes?

I don’t think you’re looking for tips that improve performance, but ways to avoid interactivity. Maybe I can help you if you detail a concrete case.

Actually I’m just looking for ways to reduce the chances of getting “in progress” when I’m using M-l or C-l. I’ve already found a way to do this by avoiding the ‘interactivity’ that leads to hangs/loading process

I’m just using this:

(defmacro make-web-jump (name prefix)
  `(defcommand ,(intern name) (search) ((:rest ,(concatenate 'string "Search with " name ": ")))
     (nsubstitute #\+ #\Space search)
     (run-shell-command (concatenate 'string ,prefix search))))

(make-web-jump "searxng" "nyxt")

This way I’m not getting any of the “hangs” that I normally do, by using stumpwm for the ‘interactivity’.

But I was wondering if there is a way to improve nyxt directly by for e.g disabling the history search or smt like that. Killing buffers C-x k never hangs, I was thinking it’s because it displays less & was looking for ways to have C-l etc. work the same way.

If you’re using StumpWM, wouldn’t be better to manage Nyxt through a CL REPL instead of interacting with it via Bash or other shells?

That would be ideal… But I have no idea how to do that, I know just enough to write bugs & break my system when it comes to common lisp :slight_smile:

I’m not sure how to load nyxt, I’ve tried cloning the repo at ~/quicklisp/local-projects, opening nyxt.asdC-c C-k but whenever I’m running (ql:quickload :nyxt) I’m getting System "history-tree" not found.

Tried to hack my way around and just ended up crashing my session a couple of times :smiley: , I’m just using stumpwm:run-shell-command "nyxt -r -e to interact with nyxt since then.

I’ll help you.

What GNU/Linux are you using?

Thanks! I’m using Arch, SBCL Although if that’s something that takes too much of your time, there is no need for it

I’ll help you to start Nyxt from a CL REPL. I don’t know if you use Slime or SLY, but the instructions I’ll give you can even be done in a shell once you invoke sbcl.

You need the dependencies listed at PKGBUILD · main · Arch Linux / Packaging / Packages / nyxt · GitLab.

Then you need to clone the Nyxt’s repository via command (ensure that ~/common-lisp/nyxt/ exists):

git clone --recurse-submodules ~/common-lisp/nyxt

From a CL REPL run:

(asdf:load-system :nyxt/gi-gtk)
(in-package :nyxt)

Then you can control Nyxt from the REPL, for instance:

(buffer-load "")

Let me know if this helps.

I had already installed the above dependencies. I guessed the cl that we need was not packaged for Arch, I manually installed

  • cl-cffi-gt
  • cl-gobject-introspection

Which fixed the dependency issue

But I was still getting
Component ASDF/USER::HISTORY-TREE not found, required by #<NASDF-SYSTEM "nyxt">

Thanks for the help! I will try fixing it some other time again, not much time left for the day

Uneducated guess: maybe use Nyxt socket so send expressions to Nyxt?

@thanosapollo you don’t need to manage CL dependencies yourself when using the method I’ve described because ASDF looks for them at ~/common-lisp/. All Nyxt CL dependencies are available at ~/common-lisp/nyxt/_build as git submodules.

Did you clone Nyxt at ~/common-lisp/nyxt/?

@aartaka I think the OP is already using --remote and --eval (see their top post).

Sorry, I've been confusing. What I mean is piping Lisp expressions from StumpWM to Nyxt socket directly. This way, there's no slowdown because of Nyxt CLI/GUI startup time, and the goal of quickly sending stuff to Nyxt is achieved.

1 Like

Killing buffers is quite light-weight, because there's only buffers to list. set-url is too involved to be instrumented. But! set-url also has a URL argument which you can pass and make it load the page right away. So you can send something like (set-url :url "") to Nyxt and it should work instantaneously.

That'd be fun to play around! When I have some free time I will try it

For now I'm just using this simple macro

(defmacro defnyxt-search (name search-url command)
  `(stumpwm:defcommand ,(intern (concatenate 'string "nyxt-" name)) (query)
       ((:string "Search: "))
      (concatenate 'string "nyxt -r -e '(" ,command "\"" ,search-url query "\"" ")'"))))

(defnyxt-search "searxng" thanos-searxng "buffer-load")
(defnyxt-search "searxng-newb" thanos-searxng "set-url-new-buffer :url")
(defnyxt-search "http" "http://" "buffer-load")

not the most elegant solution, but it works:)

set-url :url is not as fast as buffer-load (I tried it out thanks to @aadcg)