Unable to bind several keybindings via keycodes
Hi. I use two keyboard layouts on my PC and it's more convenient for me to bind keybindings using keycodes as follows:
(define-configuration base-mode
"Docstrink."
((keyscheme-map
(define-keyscheme-map "my-map" (list :import %slot-default%)
nyxt/keyscheme:emacs
;; ijkl
'(((:code 45)) scroll-down
((:code 31)) scroll-up
((:code 46)) scroll-right
((:code 44)) scroll-left)))))
But for some reason this snippet does not work as expected. None of the listed commands are bound to the corresponding keycodes. The only way it works is when I leave only one pair of keycode and command in the list of bindings:
(define-configuration base-mode
"Docstrink."
((keyscheme-map
(define-keyscheme-map "my-map" (list :import %slot-default%)
nyxt/keyscheme:emacs
'(((:code 45)) scroll-down)))))
Information
-
OS: Guix System x86_64
-
Kernel: 6.11.11
-
WM: sway 1.10
-
Nyxt version: 3.11.6
-
Installation method:
guix time-machine -q --commit=83e39340eaa416c1fd6a96f0aa95d907af27a05f -- shell nyxt -- nyxt(since it crashes on version 3.11.7 (latest version on guix now), I use 3.11.6) -
Output of
nyxt --system-information:
~$ guix time-machine -q --commit=83e39340eaa416c1fd6a96f0aa95d907af27a05f -- shell nyxt -- nyxt --system-information
/gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35/lib/libc.so.6: version `GLIBC_2.38' not found (required by /run/current-system/profile/lib/gio/modules/libgvfsdbus.so)
Failed to load module: /run/current-system/profile/lib/gio/modules/libgvfsdbus.so
Nyxt version: 3.11.6
Renderer: GI-GTK
Operating system kernel: Linux 6.11.11
Lisp implementation: SBCL 2.4.0 (Dynamic space size: 3221225472)
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.42.5 :WEBKIT-2.42 :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 :GENCGC :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.5
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: (/gnu/store/jvbqfm4xycfdqnlw6y9cd90py3zpf5bm-sbcl-cl-cffi-gtk-3.8.8-3.1700fe6/share/common-lisp/sbcl/cl-cffi-gtk/gtk/cl-cffi-gtk.asd
/gnu/store/7y7zpsmiqnbr8fc083k2yg640x0i5kam-cl-gobject-introspection-0.3-3.83beec4/share/common-lisp/source/cl-gobject-introspection/cl-gobject-introspection.asd
/gnu/store/im7b51wpskrw02rqrazn5i06glpiib4z-sbcl-cl-webkit-3.5.10/share/common-lisp/sbcl/cl-webkit/webkit2/cl-webkit2.asd)
Thank you for your work.
But for some reason this snippet does not work as expected. None of the listed commands are bound to the corresponding keycodes.
I tried your snippet and it's working for me. What makes you say it doesn't work as expected?
I'd refactor it as below but it's a matter of personal preference.
(define-configuration :document-mode
"Docstring."
((keyscheme-map
(define-keyscheme-map "my-map" (list :import %slot-default%)
nyxt/keyscheme:emacs
(list
"#45" 'nyxt/mode/document:scroll-down
"#31" 'nyxt/mode/document:scroll-up
"#46" 'nyxt/mode/document:scroll-right
"#44" 'nyxt/mode/document:scroll-left)))))
On another note, I didn't know that the Guix package was broken, I'll look into it.
Also, this may interest you: https://gist.github.com/teu5us/f2e39c442e034bb26d0da6add1145b53.
@ichernyshovvv I was able to reproduce your report but only on Guix. My wild guess is that there's a mismatch between nkeymaps' dependencies on Guix and those pinned by Nyxt as git submodules.
If you run the Flatpak, you'll see that this issue isn't reproducible.
@aadcg
On another note, I didn't know that the Guix package was broken, I'll look into it.
Yeah, On 3.11.7 I had issues with annotations. Every time I called show-annotations command it crashed. On 3.11.6 the annotations package works fine.
I'd refactor it as below but it's a matter of personal preference.
Thanks.
Also, this may interest you: https://gist.github.com/teu5us/f2e39c442e034bb26d0da6add1145b53.
Thanks for the link, but I'll probably wait for the guix package to update, since keybindings configured via keycodes look more succinct, no need for another 100-lines config file. Cannot help with the upgrade though, sorry (have no experience with common lisp at all).