From 91e1dbfd946f8396709d83701a6651b5c2ca7bdc Mon Sep 17 00:00:00 2001 From: Shav Kinderlehrer Date: Fri, 8 May 2026 17:45:15 -0400 Subject: Embed guile for custom handlers and update UI Adds support for writing custom handlers and sets the ui to be properly centered and not move around while messages are added. Also auto scrolls when the messages window gets too long. --- data/styles.xml | 6 ++++++ scm/extant-input.scm | 15 +++++++++++++++ scm/guile.xml | 6 ++++++ 3 files changed, 27 insertions(+) create mode 100644 data/styles.xml create mode 100644 scm/extant-input.scm create mode 100644 scm/guile.xml diff --git a/data/styles.xml b/data/styles.xml new file mode 100644 index 0000000..741e6dc --- /dev/null +++ b/data/styles.xml @@ -0,0 +1,6 @@ + + + + window.css + + diff --git a/scm/extant-input.scm b/scm/extant-input.scm new file mode 100644 index 0000000..d50a7fe --- /dev/null +++ b/scm/extant-input.scm @@ -0,0 +1,15 @@ +(define-module (extant input) + #:export (register-handler!)) + +(define *handlers* '()) + +(define (register-handler! proc) + (set! *handlers* (cons proc *handlers*))) + +(define (dispatch-input text) + (let loop ((handlers *handlers*)) + (if (null? handlers) + `((text . "No handlers found!") + (style . "error")) + (let ((result ((car handlers) text))) + (or result (loop (cdr handlers))))))) diff --git a/scm/guile.xml b/scm/guile.xml new file mode 100644 index 0000000..8a5368d --- /dev/null +++ b/scm/guile.xml @@ -0,0 +1,6 @@ + + + + extant-input.scm + + -- cgit v1.2.3