4
40
Fork
You've already forked tinyrwm
16

guile: add implementation #5

Open
torb wants to merge 34 commits from torb/tinyrwm:main into main
pull from: torb/tinyrwm:main
merge into: river:main
river:main
First-time contributor
Copy link

Hi!

This adds a tinyrwm implementation in Guile.

It works and demonstrates the use of wayland-scm and river.

Package definitions to get river-0.4 running on guix are provided in the manifest.scm file (including wlroots with an X11 backend, so we can hack from EXWM)

The scheme is not super beautiful, and I hope to improve this further on, but I feel this is already helpful to get started with guile and river and hope it can be considered for publication in tinyrwm :-)

Cheers,
Tor-björn

Hi! This adds a tinyrwm implementation in Guile. It works and demonstrates the use of wayland-scm and river. Package definitions to get river-0.4 running on guix are provided in the manifest.scm file (including wlroots with an X11 backend, so we can hack from EXWM) The scheme is not super beautiful, and I hope to improve this further on, but I feel this is already helpful to get started with guile and river and hope it can be considered for publication in tinyrwm :-) Cheers, Tor-björn

Very cool! I'm not very familiar with scheme but I'll try and give this a proper review soon :)

Note that the only protocol needed by tinyrwm is the river-window-management-v1 protocol, the other protocols in guile/protocol can be removed.

Very cool! I'm not very familiar with scheme but I'll try and give this a proper review soon :) Note that the only protocol needed by tinyrwm is the `river-window-management-v1` protocol, the other protocols in `guile/protocol` can be removed.
Author
First-time contributor
Copy link

Thanks, no rush!

And thanks for making river! I have tried to make a c/guile wlrootscompositor, so I understand the amount of work you have put into this!

About the protocols, don't we also need river-xkb-bindings-v1?

Thanks, no rush! And thanks for making river! I have tried to make a c/guile wlrootscompositor, so I understand the amount of work you have put into this! About the protocols, don't we also need river-xkb-bindings-v1?

@torb wrote in #5 (comment):

About the protocols, don't we also need river-xkb-bindings-v1?

Ah yes, of course :)

@torb wrote in https://codeberg.org/river/tinyrwm/pulls/5#issuecomment-12633291: > About the protocols, don't we also need river-xkb-bindings-v1? Ah yes, of course :)
torb force-pushed main from 7a96e9ca15
Some checks are pending
builds.sr.ht/alpine Build started...
builds.sr.ht/archlinux Build started...
to 2eedd1160e
Some checks are pending
builds.sr.ht/alpine Build started...
builds.sr.ht/archlinux Build started...
2026年04月05日 19:39:46 +02:00
Compare
Member
Copy link

Is there a reason the scanner formats directly to a string, rather than operating on a symbol list and pretty-printing that into the file?

Is there a reason the scanner formats directly to a string, rather than operating on a symbol list and pretty-printing that into the file?
@ -0,0 +245,4 @@
(home-page "https://codeberg.org/ifreund/zig-wlroots")
(license expat))))
(define-public river-0.4
Member
Copy link

Why does your manifest build river? Shouldn't it just build the WM?

Why does your manifest build river? Shouldn't it just build the WM?
First-time contributor
Copy link

It may be because river-0.4.x is not in Guix upstream yet.

It may be because `river-0.4.x` is not in Guix upstream yet.
Author
First-time contributor
Copy link

Yes, also libxkbcommon in guix is to old for river-0.4.

Yes, also libxkbcommon in guix is to old for river-0.4.
Author
First-time contributor
Copy link

Also, the scanner is copied straight from wayland-scm, I have not payed it much attention, since it works :-)

Also, the scanner is copied straight from wayland-scm, I have not payed it much attention, since it works :-)
Member
Copy link

This repo collects tiny example river window managers. Build scripts for river itself are out of scope IMO. Every WM in this repo should assume river is already installed.

Does wayland-scm enforce a dependency on guix as a build system? Not every guile user is a guix user (f.e. myself), so this would be unfortunate...
I know that there is a more traditional way of installing guix packages, does wayland-scm support that?

This repo collects tiny example river window managers. Build scripts for river itself are out of scope IMO. Every WM in this repo should assume river is already installed. Does wayland-scm enforce a dependency on guix as a build system? Not every guile user is a guix user (f.e. myself), so this would be unfortunate... I know that there is a more traditional way of installing guix packages, does wayland-scm support that?
Author
First-time contributor
Copy link

Wayland-scm does not depend on guix (or guile, it is actually r7rs).

I will add a todo for adding a Makefile. This would be for binding the protocol and running tinyrwm.scm for cases where river, wayland-scm etc. is already installed?

I think it is very useful to include a manifest.scm though, to get users up and running quicker when guix is available. This will be useful also in the future, when river0.4 is available upstream, but of course greatly simplified.

Building river requires the correct versions of a number of dependencies, and figuring this out took me a couple of hours (though cleverer people probably do this quicker)

Wayland-scm does not depend on guix (or guile, it is actually r7rs). I will add a todo for adding a Makefile. This would be for binding the protocol and running tinyrwm.scm for cases where river, wayland-scm etc. is already installed? I think it is very useful to include a manifest.scm though, to get users up and running quicker when guix is available. This will be useful also in the future, when river0.4 is available upstream, but of course greatly simplified. Building river requires the correct versions of a number of dependencies, and figuring this out took me a couple of hours (though cleverer people probably do this quicker)
@ -0,0 +3,4 @@
;;; terms of the Do What The Fuck You Want To Public License, Version 2,
;;; as published by Sam Hocevar. See the COPYING file for more details.
;;; a tiny no frills scanner that dumps client code to stdout
Owner
Copy link

There doesn't seem to be anything river or tinyrwm specific about this scanner script.

Why isn't this something provided by upstream wayland-scm? Is it expected that every user of wayland-scm writes their own scanner?

There doesn't seem to be anything river or tinyrwm specific about this scanner script. Why isn't this something provided by upstream wayland-scm? Is it expected that every user of wayland-scm writes their own scanner?
Author
First-time contributor
Copy link

The script is copied from upstream wayland-scm.

It is not included in the guix package of wayland-scm. It felt quicker (for this experimentation) to just copy it rather than fixing the guix package, which is the correct solution.

The script is copied from upstream wayland-scm. It is not included in the guix package of wayland-scm. It felt quicker (for this experimentation) to just copy it rather than fixing the guix package, which is the correct solution.
Owner
Copy link

Hmm, it would be good to fix that upstream. At the very least we should list that as a TODO in the guile readme.

Hmm, it would be good to fix that upstream. At the very least we should list that as a TODO in the guile readme.
Author
First-time contributor
Copy link

Yes. I think it would also make sense to create a guile-river-protocols package, which would install guile bindings for all the river protocols, as well. I added a todo section to the readme. I will be happy to take a look at this, but my life is a bit chaotic the coming month with an upcoming thesis defence=)

Yes. I think it would also make sense to create a guile-river-protocols package, which would install guile bindings for all the river protocols, as well. I added a todo section to the readme. I will be happy to take a look at this, but my life is a bit chaotic the coming month with an upcoming thesis defence=)
@ -0,0 +94,4 @@
RIVER-WINDOW-V1-EDGES-RIGHT))))))))
;;; Type declarations
(define-record-type <seat-operation>
Member
Copy link

You're already using goops, so why are these records and not classes?

You're already using goops, so why are these records and not classes?
Author
First-time contributor
Copy link

I started transcribing tinyrwm.janet into scheme, and originally used record for everything. After I got this working, I have tried to translate it into nicer Guile (including using goops.)

These are the remaining ones, and I plan to change them into goops classes.

I started transcribing tinyrwm.janet into scheme, and originally used record for everything. After I got this working, I have tried to translate it into nicer Guile (including using goops.) These are the remaining ones, and I plan to change them into goops classes.
@ -0,0 +229,4 @@
(seat-operation-dx operation))
(+ (seat-operation-start-y operation)
(seat-operation-dy operation))))
((equal? (seat-operation-type operation) OPERATION-TYPE-RESIZE)
Member
Copy link

I think these two equal?'s can be eqv?'s.

I think these two `equal?`'s can be `eqv?`'s.
Author
First-time contributor
Copy link

Yes! Well spotted and thank you :-)

Yes! Well spotted and thank you :-)
Author
First-time contributor
Copy link

I had some time to play with this, and I feel it is beginning to come together better. The infrastructure work adding a Makefile for running without Guix, and updating Guix upstream river remains to be done though.

There are probably remaining errors that I have not found yet. An ugly one I will have to solve is that I use a function get-a-seat to find any seat in some places where I need to update focus in a function that was not passed a seat.

Edit: there is already a pull request for updating the Guix paxkage of river :-)

I had some time to play with this, and I feel it is beginning to come together better. The infrastructure work adding a Makefile for running without Guix, and updating Guix upstream river remains to be done though. There are probably remaining errors that I have not found yet. An ugly one I will have to solve is that I use a function get-a-seat to find any seat in some places where I need to update focus in a function that was not passed a seat. Edit: there is already a pull request for updating the Guix paxkage of river :-)

How do I build this without guix? It seems that I would need to install wayland-scm manually but I'm not sure where it is expected to be installed to...

The README should ideally document the exact commands a user needs to build and run this program with minimal system dependencies.

I don't think wayland-scm is packaged for any distros other than guix so we do need some instructions on how to install it.

How do I build this without guix? It seems that I would need to install wayland-scm manually but I'm not sure where it is expected to be installed to... The README should ideally document the exact commands a user needs to build and run this program with minimal system dependencies. I don't think wayland-scm is packaged for any distros other than guix so we do need some instructions on how to install it.
Author
First-time contributor
Copy link

@ifreund wrote in #5 (comment):

How do I build this without guix? It seems that I would need to install wayland-scm manually but I'm not sure where it is expected to be installed to...

The README should ideally document the exact commands a user needs to build and run this program with minimal system dependencies.

I don't think wayland-scm is packaged for any distros other than guix so we do need some instructions on how to install it.

Thanks for looking at this!

I tried to updated the readme to be more helpful. The important thing is that you have to generate protocol bindings (there is a guile.Makefile for this in the wayland-scm root folder) and then make sure your GUILE_LOAD_PATH includes the root of the wayland-scm checkout.

Do you think the readme is clear enough, or should I try to improve it?

@ifreund wrote in https://codeberg.org/river/tinyrwm/pulls/5#issuecomment-13987442: > How do I build this without guix? It seems that I would need to install wayland-scm manually but I'm not sure where it is expected to be installed to... > > The README should ideally document the exact commands a user needs to build and run this program with minimal system dependencies. > > I don't think wayland-scm is packaged for any distros other than guix so we do need some instructions on how to install it. Thanks for looking at this! I tried to updated the readme to be more helpful. The important thing is that you have to generate protocol bindings (there is a guile.Makefile for this in the wayland-scm root folder) and then make sure your GUILE_LOAD_PATH includes the root of the wayland-scm checkout. Do you think the readme is clear enough, or should I try to improve it?

Ideally it is trivial for a user with no previous guile experience (e.g. me) to copy paste a few commands from the README and get a binary they can run as a window manager, regardless of their Linux distro/BSD of choice.

Perhaps adding CI coverage for building the guile implementation would make clear the minimal system dependencies and commands/steps necessary?

I found that helpful just now while dealing with the lua implementation's build instructions.

Ideally it is trivial for a user with no previous guile experience (e.g. me) to copy paste a few commands from the README and get a binary they can run as a window manager, regardless of their Linux distro/BSD of choice. Perhaps adding CI coverage for building the guile implementation would make clear the minimal system dependencies and commands/steps necessary? I found that helpful just now while dealing with the lua implementation's build instructions.
Author
First-time contributor
Copy link

I added a make target to install the bindings locally, could you test this? It works for me.

I added a make target to install the bindings locally, could you test this? It works for me.
All checks were successful
builds.sr.ht/archlinux Job completed
builds.sr.ht/alpine Job completed
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u main:torb-main
git switch torb-main

Merge

Merge the changes and update on Forgejo.
git switch main
git merge --no-ff torb-main
git switch torb-main
git rebase main
git switch main
git merge --ff-only torb-main
git switch torb-main
git rebase main
git switch main
git merge --no-ff torb-main
git switch main
git merge --squash torb-main
git switch main
git merge --ff-only torb-main
git switch main
git merge torb-main
git push origin main
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
river/tinyrwm!5
Reference in a new issue
river/tinyrwm
No description provided.
Delete branch "torb/tinyrwm:main"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?