42 lines
1.5 KiB
Scheme
42 lines
1.5 KiB
Scheme
(define (start)
|
|
(apply orion-wm (command-line)))
|
|
|
|
(define (orion-wm . args)
|
|
(let ((dpy (open-display)))
|
|
(if (not dpy)
|
|
(begin
|
|
(mdisplay "Default X-Server not found. Please set the environment variable DISPLAY to the name of your X-Server.\n")
|
|
(exit)))
|
|
|
|
(use-x-error-warnings! dpy #t)
|
|
(synchronize dpy #t)
|
|
(init-sync-x-events dpy)
|
|
;; first try if there is already a window-manager
|
|
(with-handler
|
|
(lambda (condition punt)
|
|
(mdisplay "Another window manager is already running on this screen\nTerminate it before running Orion.\n")
|
|
(exit))
|
|
(lambda ()
|
|
(display-sync dpy #f)
|
|
(display-select-input dpy (default-root-window dpy)
|
|
(event-mask substructure-redirect))
|
|
(display-sync dpy #f)))
|
|
|
|
(let* ((initial-windows (window-children dpy (default-root-window dpy)))
|
|
(root-options (load-configuration dpy))
|
|
;; little hack to deal with cross-references:
|
|
(cross-ref-hack (lambda (name)
|
|
(case name
|
|
((backup-layout) backup-layout)
|
|
(else (error "cross-ref-hack" name)))))
|
|
(root-manager (create-root-wm dpy root-options cross-ref-hack)))
|
|
(restore-layout root-manager)
|
|
(for-each (lambda (window)
|
|
(root-wm-manage-window root-manager window))
|
|
initial-windows)
|
|
(map-window dpy (wm:window (root-wm:initial-manager root-manager)))
|
|
(display "Orion is up and running...\n")
|
|
(wait-for-root-wm root-manager)
|
|
(backup-layout root-manager)
|
|
(display "Orion finished\n"))))
|