AtlatestRepositorysigil-wm
1
(import (sigil async)2
(sigil io)3
(sigil process)4
(sigil wm host)5
(sigil wm model)6
(sigil wm scene)7
(sigil wm repl))9
(define host (start-host! protocols: 32))10
(define output-id #f)11
(define layer-id #f)12
(define arranged? #f)13
(define facts? #f)15
(on-event! host16
(lambda (event)17
(let ((id (event-ref event id:)))18
(case (event-type event)19
((ready)20
(configure-device! host 1 "us" 25 600)21
(set-seat-capabilities! host 3)22
(set-pointer-route! host #t))23
((output-added)24
(set! output-id id)25
(configure-output! host id26
(dict enabled: #t x: 0 y: 0 scale: 1 transform: 027
mode: -1 width: 960 height: 640 refresh: 60000)))28
((output-configured)29
(set-default-layer-output! host id)30
(display "WAYLAND_SOCKET=")31
(display (host-socket host))32
(newline)33
(flush-output-port))34
((layer-state)35
(set! layer-id id)36
(when (event-ref event initialized?:)37
(unless (and (= (event-ref event output:) output-id)38
(= (event-ref event anchor:) 13)39
(= (event-ref event exclusive-zone:) 32)40
(= (event-ref event margin-left:) 6)41
(= (event-ref event margin-top:) 3)42
(= (event-ref event desired-height:) 32))43
(error "layer facts were not copied" (event-raw event)))44
(set! facts? #t)45
(unless arranged?46
(configure-layer! host id output-id 950 32))))47
((window-mapped)48
(set! arranged? #t)49
(submit-plan! host50
(make-scene-plan51
(list (placement window: id box: (rect x: 6 y: 3 width: 950 height: 32)))52
id 200)))53
((focus-changed)54
(when (= id layer-id)55
(display "LAYER_READY=PASS explicit geometry and focus\n")56
(flush-output-port)))57
((window-destroyed) (stop-host! host))))))59
(with-async60
(let ((repl (start-repl! host (getenv "SIGIL_WM_REPL") (interaction-environment))))61
(run-host! host)62
(stop-repl! repl)))63
(unless (and facts? arranged? (= (host-statistic host 1) 0)64
(= (host-statistic host 2) 0) (= (host-statistic host 3) 0))65
(error "layer lifecycle or scene failed"))66
(display "LAYERS=PASS copied facts explicit placement focus teardown\n")