The Stream132

Tiny pieces of thinking, connections and knowledge – streamified.

GNOME Wayland Desktop Portal/Nautilus/Screen Sharing Issues

Over the last week, I learned that it’s possible to have multiple desktop portals (implementations, I guess?) for Wayland active, and even specify which one to choose for which one.

This is what this looks like:

home.nix
# ...    xdg.portal = {      enable = true;      extraPortals = [        pkgs.xdg-desktop-portal-gtk        pkgs.xdg-desktop-portal-gnome      ];      config.common = {        # for files, mainly, since my nautilus takes ages to load        default = "gtk";         # screen sharing doesn't work otherwise on GNOME        "org.freedesktop.impl.portal.ScreenCast" = "gnome";        "org.freedesktop.impl.portal.RemoteDesktop" = "gnome";      };    };# ...
+UnoCSS
+Wasm

Fluid Scales in Tailwind

Some time ago, I held a lightning talk at our functional programming meetup on Fluid Type Scales (Where you try and get rid of class="sm:... md:... lg:..." whenever it makes sense).

This was, for a long time, a good reason for me to use UnoCSS.

But today, I learned that someone built this for Tailwind, too:

But since this doesn’t support Tailwind 4, I’ll be using the slightly uglier, but simpler (and maintained!) tailwind-clamp for now.

May your utility classes always be simple :)

Lean and Wasm

Today I was thinking about how easy it is to include Lean into a website.

Since it compiles via an intermediate C layer, it shouldn’t be that hard to do this via Emscripten, but apparently it’s harder than that: Since there’s #eval, every function of the language needs to be exported per default (only then it’s really a full Lean compiler), and that apparently hit a limit for the number of imports and exports a WASM program(?, module?) allows.

That has been increased since then, but now there’s other issues.

Wild.

Notes

Links

Better Computer Use

Some time ago, I visited a friend who’s fairly well versed in tech (e.g. NeoVim, can code) and watches him struggle with editing a file in Word fast on someone else’s Laptop.

I asked him whether he knew about Ctrl-arrow for wordwise movement (which he didn’t), and was fairly surprised. But in hindsight, I didn’t know that for the longest time either.

I took this as an example to start writing on Better Computer Use (then only a collection of basically “Keyboard Shortcuts You Might Want To Know”).

Today I revisited this, and something that started out as “You might want to know these shortcuts” ended in a discussion on how Software Developers and Product Designers should structure their UIs.

Feel free to check it out, tell me what you think, and tell me where I’m wrong: Better Computer Use

(Or just wait until it’s more polished.)

:)

+AI
+Lean
+SolidJS

Async Link Fetching in Emacs

Today I finally tackled something that has annoyed me for a while since switching most of my editing/digital gardening/second brain-writing over to Emacs.

Whenever I took 30 minutes and tried to get title fetching of links to work, I couldn’t get it to work in this self-allotted time. So I asked Opus to do the dumbest thing possible: Just fetch it via curl, and then apply stuff asynchronously.

(Obviously the other, non-dumb way should work too, but I’ve spent way too much time on this now either way.)
(And apparently there’s also url-insert-file-contents, maybe I’m gonna try that some other time.)

(defun flt--url-at-point ()  "Get URL at point, or nil."  (thing-at-point 'url))
(defun flt--url-from-kill-ring ()  "Get URL from kill ring if it looks like one, or nil."  (let ((text (current-kill 0 t)))    (when (and text (string-match-p "\\`https?://" text))      (string-trim text))))
(defun flt--get-url ()  "Get URL from point first, then kill ring. Nil if neither has one."  (or (flt--url-at-point)      (flt--url-from-kill-ring)))
(defun flt--extract-title (html)  "Extract <title> content from HTML string."  (when (string-match "<title[^>]*>\\([^<]*\\)</title>" html)    (string-trim (match-string 1 html))))
(defun flt--insert-markdown-link (url title marker)  "Replace URL at MARKER with a markdown link, or insert at MARKER."  (with-current-buffer (marker-buffer marker)    (save-excursion      (goto-char marker)      ;; If there's a raw URL at point, replace it      (let ((url-bounds (thing-at-point-bounds-of-url-at-point)))        (if url-bounds            (progn              (delete-region (car url-bounds) (cdr url-bounds))              (insert (format "[%s](%s)" title url)))          (insert (format "[%s](%s)" title url)))))))
(defun flt-fetch-link-title ()  "Fetch the title of a URL (at point or kill ring) and insert a markdown link.If point is on a URL, replaces it. Otherwise inserts at point."  (interactive)  (let ((url (flt--get-url)))    (if (not url)        (message "No URL found at point or in kill ring.")      (let ((marker (point-marker))            (buf (generate-new-buffer " *flt-curl*")))        (message "Fetching title for %s..." url)        (make-process         :name "flt-curl"         :buffer buf         :command (list "curl" "-sL" "-m" "10"                        "-H" "User-Agent: Emacs"                        "--" url)         :sentinel         (lambda (proc _event)           (when (eq (process-status proc) 'exit)             (let ((title                    (with-current-buffer (process-buffer proc)                      (flt--extract-title (buffer-string)))))               (if title                   (progn                     (flt--insert-markdown-link url title marker)                     (message "Inserted: [%s](%s)" title url))                 (message "Could not extract title from %s" url)))             (kill-buffer (process-buffer proc))             (set-marker marker nil))))))))
(map! :leader      :desc "->[title](link)" :nv "d f" #'flt-fetch-link-title)

And in the meantime, I also learned that markers exist!

So now, I can fetch link titles again, like I’m used to :)

New notes

I’ve been dragging quite a few notes around with me for the last one, two weeks.

Here they are! :)

+AI Agents
+LLM Usage
+Oxide

Slidev QRCode Addon

For presentations, I’m using slidev, a pretty cool and versatile tool (Markdown slides with inline HTML/Vue, so you can do basically anything on your slides), which has lots of cool features.

One minor annoyance: If you’re using either of the QRCode addons and want to add more than one QR Code per slide deck, it breaks.

Luckily, with the power of the web, this is pretty easy to fix:

We can just define a component:

<template>  <QrcodeCanvas    :value="value"    :size="width"    :foreground="foreground"    :background="background"    :margin="margin"    level="H"  /></template>
<script lang="ts" setup>import { QrcodeCanvas } from 'qrcode.vue'
const props = withDefaults(  defineProps<{    value: string    width?: number    height?: number    color?: string    margin?: number  }>(),  {    width: 200,    color: '#000000',    margin: 2,  },)
const foreground = props.color.startsWith('#') ? props.color : `#${props.color}`const background = '#FFFFFF'</script>

And use it:

<QRCode class="rounded" value="https://beathagenlocher.com/me" :width="140" :height="140" />

Sweet!