mzan

A diary about what I learned and what I'm learning

These are #LearnedLessons about #UserInterfaces.

Right now I'm using hyprscroller that is a scrollable tiling of windows. Similar windows managers are PaperWM, Karousel, Niri, papersway.

In a scrollable window manager, windows are arranged in columns on an infinite strip going to the right. Every new window does not resize previous windows, but it is added in a new column of the stripe. All windows remain readable, in case their column is in the current visible area.

There is a direct relationship between spatial (i.e. the windows on the screen) and temporal locality (i.e. the task to complete), because the recently opened windows are near together. Windows can be moved, like paper on a desk.

These are #LearnedLesson about #keyboards.

The ideal #keyboard must have a programmable and open-source firmware like QMK. These firmware support advanced features like: macros; distinction between short and long press of a key; additional modifier keys for changing the behavior of other keys; and so on...

I have an Ergodox keyboard. I'm accustomed to Columnar Layout (i.e. the keys are on a regular matrix), and I cannot go back.

Contrary to my initial wisdom, if you have a programmable firmware, then a fancy keyboard with a lot of keys is not important, because every key can have two or more functions. In fact, I didn't programmed the far-away keys at all.

I like a split keyboard, because it is adaptable to the width of shoulders and arms.

I switched to a #dvorak based layout. Now I type with all fingers, in an efficient way, and I don't feel any stress. But, the main difference is not between dvorak and qwerty layout. The root of the problem is that with qwerty I accumulated bad-habits, that I were not able to remove. But switching to a new layout, I were forced to learn from scratch, but this time I started with sane habits.

The drawback of a potentially better layout like #dvorak (I like it very much) is that I had to customize many DoomEmacs keybindings, because some key chords and sequences does not make sense anymore.

This is a #LearnedTask.

I create a #guix project in a directory like /home/mzan/fun-projects/snow.

This is the guix.scm file

(use-modules
  ((guix licenses) #:prefix license:)
  (guix packages)
  (guix download)
  (guix gexp)
  (guix git-download)
  (guix build-system asdf)
  (guix build-system gnu)
  (guix utils)
  (gnu packages)
  (gnu packages bash)
  (gnu packages admin)
  (gnu packages autotools)
  (gnu packages base)
  (gnu packages lisp)
  (gnu packages lisp-xyz)
  (gnu packages commencement))

(define %source-dir (dirname (current-filename)))

(package
    (name "snow-assembler")
    (version "0.1")
    (source (local-file %source-dir #:recursive? #t))
    (build-system asdf-build-system/sbcl)
    (native-inputs
     (list
        sbcl
        sbcl-slynk
        sbcl-agnostic-lizard

        sbcl-defstar
        sbcl-trivia
        sbcl-alexandria
        sbcl-trivial-types
        sbcl-cl-str
        sbcl-parse-float
        sbcl-iterate
        sbcl-let-plus
        sbcl-array-operations
        sbcl-sdl2
        sbcl-trivial-benchmark
        sbcl-random-state))
    (outputs '("out" "lib"))
    (synopsis "Generate a fractal image")
    (description
     "Generate a fractal image.")
    (home-page "")
    (license license:lgpl3+))

Note that all used #commonlisp packages are defined in the project, and that the sbcl-sdl2 package will take care to install also the external (i.e. C) library. sbcl-... packages are needed only for development inside Emacs.

This is the .envrc file to use for direnv.

eval $(guix shell --search-paths)
export GUILE_LOAD_PATH="$PWD:$GUILE_LOAD_PATH"

It will be enable with direnv allow in the shell, or with envrc-allow in Emacs.

In case of changes in the guix.scm file, it can be reloaded with direnv reload in the shell, or envrc-reload in Emacs.

This is the #commonlisp #asdf project file snow-assembler.asd

(asdf:defsystem "snow-assembler"
  :description "Draw a fractal"

  :author "mzan@dokmelody.org"
  :license  "LGPL-3.0-or-later"
  :depends-on (
     "alexandria"
     "trivial-types"
     "defstar"
     "iterate"
     "str"
     "let-plus"
     "array-operations"
     "sdl2"
     "cl-opengl"
     "cffi"
     "trivial-benchmark"
     "random-state")

  :components ((:file "snow-assembler")))

In this file, I'm reusing the packages I defined in guix.scm.

In ~/.sbclrc I instruct #asdf that there is a system (i.e. a #commonlisp project) in the directory of the project. I'm using something like this

(require :asdf)

; NOTE: all subdirectories of specified directories are searched for asdf project files
(asdf:initialize-source-registry
  `(:source-registry
     (:tree "/home/mzan/fun-projects/snow")
     (:tree "/home/mzan/communities")
     :inherit-configuration))

I launch Emacs. I open the snow-assembler.asd file. I make sure that the #guix environment is loaded executing the Emacs function envrc-reload.

I start a connection to sbcl using sly.

I open the #sbcl #commonlisp REPL, and I load the system with (asdf:load-system "snow-assembler").

Now, I'm ready to code in #commonlisp, using #emacs and #sly.

This is a #LearnedTask. Scope: – customize default #guix channel; – use it in the working environment/system (i.e. “eating your own dog food”); – send patches to #guix upstream; – wait patches are merged;

I installed #guix from source code, as described here.

I'm using Stacked-Git for managing patches.

When I need to extend #guix, I search first in the contributor page if there is some open pull request to use as starting point. There can be also Guix channels in external repositories.

I create a patch, using Stacked-Git.

I test the build, using the instructions in Guix manual.

I'm using just for defining simple scripts, and nushell as scripting language. These are the scripts in justfile for system upgrade and pull:

system-upgrade:
    #!/usr/bin/env nu
    cd guix-repo
    stg branch | into string | str trim | $in == "master"
    sudo -E ./pre-inst-env guix system reconfigure /home/mzan/lavoro/admin/guix/think/config-nonguix.scm --keep-going

pull:
    #!/usr/bin/env nu
    guix pull
    cd guix-repo
    stg branch | into string | str trim | $in == "master"
    stg pull

The tricky part (i.e. not so much documented) is in sudo -E ./pre-inst-env guix system reconfigure, in particular sudo -E, for using the fork in the directory. Without -E, it will not work correctly.