nyxt
nyxt copied to clipboard
Open new URL from the command line
Describe the bug After creating a nyxt thread, a new url cannot be opened with the existing thread out of nyxt.
Precise recipe to reproduce the issue
- open a nyxt
- open a terminal and run
nyxt <some url>
Information
- OS name+version: nixos 24.05.20240410.1042fd8
- Graphics card and driver: intel A770
- Desktop environment / Window manager name+version: xmonad
- How you installed Nyxt (Guix pack, package manager, build from source): nix
- Information from
show-system-information
:
Nyxt version: 3.11.6
Renderer: GI-GTK
Operating system kernel: Linux 6.8.5
Lisp implementation: SBCL 2.4.3 (Dynamic space size: 3145728000)
Features: (:NYXT-GI-GTK :NYXT-GTK :NYXT-3.11 :NYXT-3 :NYXT-3.11.6
:CLIPBOARD-CONTENT-METHOD :SWANK :SLYNK :PLUMP-UTF-32 :PARENSCRIPT :NSYMBOLS
:FSET-EXT-STRINGS :NAMED-READTABLES :CL-FAD :LPARALLEL :21BIT-CHARS
:CUSTOM-HASH-TABLE-NATIVE :CL-PPCRE-UNICODE :CL-UNICODE :CHUNGA :FLEXI-STREAMS
:CL-PPCRE :WEBKIT2 :WEBKIT-2.44.0 :WEBKIT-2.44 :WEBKIT-2
:WEBKIT2-CORS-ALLOWLIST :WEBKIT2-PASTE-PLAINTEXT :WEBKIT2-TRACKING
:WEBKIT2-MUTE :WEBKIT2-EMOJI :WEBKIT2-MEDIA :WEBKIT2-SANDBOXING :GTK-3-22
:GTK-3-20 :GTK-3-18 :GTK-3-16 :GTK-3-14 :GTK-3-12 :GTK-3-10 :GTK-3-8 :GTK-3-6
:GTK-3-4 :GTK :GDK-3-22 :GDK-3-20 :GDK-3-18 :GDK-3-16 :GDK-3-14 :GDK-3-12
:GDK-3-10 :GDK-3-8 :GDK-3-6 :GDK-3-4 :CAIRO-1-10 :CAIRO-1-12 :GDK-PIXBUF
:CLOSER-MOP :GLIB-2-30 :GLIB-2-32 :GLIB-2-34 :GLIB-2-36 :GLIB-2-38 :GLIB-2-40
:GLIB-2-42 :GLIB-2-44 :GLIB-2-46 :GLIB-2-48 :GLIB-2-50 :GLIB-2-52 :GLIB-2-54
:GLIB-2-56 :GLIB-2-58 :GLIB :BORDEAUX-THREADS :GLOBAL-VARS
:ASDF-SYSTEM-CONNECTIONS :LPARALLEL.WITH-CLTL2 :LPARALLEL.WITH-CAS
:LPARALLEL.WITH-STEALING-SCHEDULER :SPLIT-SEQUENCE
CFFI-FEATURES:FLAT-NAMESPACE CFFI-FEATURES:X86-64 CFFI-FEATURES:UNIX :CFFI
CFFI-SYS::FLAT-NAMESPACE ALEXANDRIA::SEQUENCE-EMPTYP :FAST-IO-SV :FAST-IO
:CL-JSON-CLOS :CL-JSON :SBCL-USES-SB-ROTATE-BYTE CHIPZ-SYSTEM:GRAY-STREAMS
:THREAD-SUPPORT :ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX
:NON-BASE-CHARS-EXIST-P :ASDF-UNICODE :ARENA-ALLOCATOR :X86-64 :MARK-REGION-GC
:64-BIT :ANSI-CL :COMMON-LISP :ELF :IEEE-FLOATING-POINT :LINUX :LITTLE-ENDIAN
:PACKAGE-LOCAL-NICKNAMES :SB-CORE-COMPRESSION :SB-LDB :SB-PACKAGE-LOCKS
:SB-THREAD :SB-UNICODE :SBCL :UNIX)
ASDF version: 3.3.6
ASDF registries: (NYXT-SOURCE-REGISTRY ENVIRONMENT-SOURCE-REGISTRY USER-SOURCE-REGISTRY
USER-SOURCE-REGISTRY-DIRECTORY
DEFAULT-USER-SOURCE-REGISTRY SYSTEM-SOURCE-REGISTRY
SYSTEM-SOURCE-REGISTRY-DIRECTORY
DEFAULT-SYSTEM-SOURCE-REGISTRY)
Critical dependencies: (/nix/store/yal8d9j9x34w4wzyqf7rdsc52lx50b3w-sbcl-cl-cffi-gtk-20230214-git/gtk/cl-cffi-gtk.asd
/nix/store/zfl2bgv6lk3859gj5im5ndfa3hki6wr9-sbcl-cl-gobject-introspection-20230618-git/cl-gobject-introspection.asd
/nix/store/37pzbd8lhfyi9zmccxyhf671z8d38yq6-sbcl-cl-webkit2-20230618-git/webkit2/cl-webkit2.asd)
Output when started from a shell
The new nyxt command outputs:
Nyxt version 3.11.6
<INFO> [18:39:52] Source location: #P"/nix/store/0gs614434zn0jmi0r9r5clp5hja4bxab-source-patched/"
<INFO> [18:39:52] Nyxt already started, requesting to open URL(s): http://google.com
list-messages
in old nyxt thread appends:
WARN - Warning: Error on separate thread: (UNSIGNED-BYTE 8) is not a valid :ELEMENT-TYPE for MAKE-STRING
@Vonfry your goal is to open a new window, not to start a new Nyxt process. From a Nyxt window, you can interactively call the command make-window
. To achieve the same programmatically, please see https://discourse.atlas.engineer/t/how-to-open-a-new-browser-window-from-command-line/811.
André A. Gomes @.***> writes:
@Vonfry your goal is to open a new window, not to start a new Nyxt process.
Right, my goal is not to start a new Nyxt process, but is also not to open a new window.
Like firefox, chromium and qutebrowser, you can open a url in the current existing window in a new tab from cli with xdg-open easily, which is used by other applications to open a url with external application.
When there is no existing nyxt process, use ~nyxt
At least, it should be open a new process right? Or open the url in the existing process in a new window or a new buffer in existing window?
@Vonfry, that sounds reasonable to me indeed. However, in the current architecture (in which I didn't participate), Nyxt starts as a server by default. I don't consider it a sane default. In the near term, it is unlikely to change since it would require a major version bump.
In the meantime, I have found out is that the recipe I've shared above doesn't work anymore. I need to investigate.
In the meantime, I have found out is that the recipe I've shared above doesn't work anymore. I need to investigate.
Right, the some error "Error on separate thread: (UNSIGNED-BYTE 8) is not a valid :ELEMENT-TYPE for MAKE-STRING" for me is thrown with nyxt -r -e '(make-window "https://github.com")'
and nyxt https://github.com
.
Perhaps this issue is the one I want to really report.
Like firefox, chromium and qutebrowser, you can open a url in the current existing window in a new tab from cli with xdg-open easily, which is used by other applications to open a url with external application.
xdg-open not working when nyxt is the default browser and nyxt is already running is what brought me here. I'm frequently opening links from other applications and can't really set nyxt as my default browser with that restriction. I'd really like to though.
@Vonfry I had a deeper look at the issue and have some conclusions.
I take back my words above:
in the current architecture (in which I didn't participate), Nyxt starts as a server by default. I don't consider it a sane default.
When Nyxt starts as a server, then it's easier to ensure that a unique process exists. And that's a good default since it enables issuing nyxt <URL>
to open URL (in an existing Nyxt process) in a new buffer or window.
By default, nyxt <URL>
either starts a new Nyxt process (if none exist) or opens URL in a new buffer (in the existing process).
I can reproduce the error you report - WARN - Warning: Error on separate thread: (UNSIGNED-BYTE 8) is not a valid :ELEMENT-TYPE for MAKE-STRING
.
The bug comes from alexandria:read-stream-content-into-string
, and I'll discuss upstream on how to fix it.
Note that you're facing this bug since you installed via Nix, which bundles a version of alexandria
with this bug. The Flatpak, which comes with an older alexandria
version, is clean.
@proehlen how did you install Nyxt?
@proehlen how did you install Nyxt?
Nix package manager on an Arch system.
@proehlen thanks.
The Nyxt team only maintains the distribution on Guix and Flatpak. All other packaging efforts are maintained by others.
This bug is present on Guix, but not on Flatpak.
The best way to proceed here is to report and fix the bug upstream and bump alexandria
on Guix.
As far as Nyxt is concerned, in some sense, this bug isn't really our responsibility since we pin alexandria
as a git submodule at commit 49e82ad (which is bug-free).
Note that the Nix maintainers could fix this by closing https://github.com/NixOS/nixpkgs/issues/302795, i.e. by relying on dependencies versions that we declare. There's a promising open PR, see https://github.com/NixOS/nixpkgs/pull/321845/.
The best way to proceed here is to report and fix the bug upstream
I think the following is an issue that relates to this problem. It was created from a discussion the Alexandria mailing list:
https://gitlab.common-lisp.net/alexandria/alexandria/-/issues/28
Unforunately, I'm not a Common Lisper (yet) and don't know how to intelligently assert that a) it's related to the problem in Nyxt, and b) that it's a bug that they should fix.