diff --git a/README.md b/README.md index ad3c7b0..f87a1a2 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,30 @@ # riverguile Scripting layer for the [river](https://github.com/riverwm/river) Wayland -server using [Guile Scheme](https://www.gnu.org/software/guile/). +server using [Guile Scheme](https://www.gnu.org/software/guile/). Send commands +to river and install handlers for various events, including layout demands. -Send commands to river and install handlers for various events, inclusing -layout events. +The ultimate aim of giverguile is to allow comfortable scripting in the context +of desktop operations, including window management. -Uppon launch, riverguile tries to load a scheme script and checks the following -paths for it in the given order: +> "So, the UNIX philosophy is nice and all, but I wish I could script my desktop +> in a way that's a bit more integrated and less hacky." -* `layout.scm` -* `$XDG_CONFIG_HOME/river/layout.scm` -* `$HOME/.config/river/layout.scm` -* `/etc/riverguile/layout.scm` +Do you agree with that statement? Do you like Lisp / Scheme? Do you believe +policy over mechanism is the only sane way to design a scripting API? Then +riverguile might be what you want! -In the context of this script, a special procedure `(install-handler key proc)` -is available, which can be used to install handlers to certain events. -Check the man page for more information. - -Here is an example `layout.scm` file replicating rivertiles behavior of having -a main window and a stack of windows aside while also automatically locking -the screen after five minutes of inactivity. +Riverguile follows river development closely, exposing new functionality as +scheme procedures and advocating for even more scripting features. Right now, +riverguile is implemented as an interpreter for river init scripts. ```scheme +#!/bin/env riverguile +!# + +(use-modules (riverguile)) + +;; Lock the screen after five minutes and darken the screen. (install-handler 'idle:300 (lambda (event) (cond ((eq? event 'idle) (system "swaylock &") (system "backlight.sh set-to 40")) @@ -48,6 +50,8 @@ the screen after five minutes of inactivity. (append (list (list x y left h)) (layout:rows (- n 1) (+ x left) y right h))))) +;; Replicate rivertile. +(R default-layout riverguile) (install-handler 'layout-demand (lambda (view-count width height tags output) (layout:split view-count 0 0 width height))) ```