wiki:InitHook
close Warning: Can't synchronize with repository "(default)" ("(default)" is not readable or not a Git repository.). Look in the Trac log for more information.

Init hook

At startup, just after the creation of the first group, CLFSWM calls the *init-hook*. With this hook you can add more groups or configure the *root-group*.

Here is my current *init-hook*:

(defun my-init-hook ()
  (dbg 'my-init-hook)
  (let ((group (create-group :name "Default")))
    (add-group group *root-group*)
    (add-group (create-group :name "Lisp") *root-group*)
    (add-group (create-group :name "Test") *root-group*)
    (focus-all-childs group *root-group*)))

(setf *init-hook* #'my-init-hook)

Here is a more complex example:

(defun my-init-hook ()
  (dbg 'my-init-hook)
  (let ((group (create-group :name "Default" :layout #'tile-space-layout)))
    (add-group group *root-group*)
    (setf (group-data-slot group :tile-size) 0.7))
  (add-group (create-group :name "The Gimp" :x 0.6 :y 0 :w 0.3 :h 0.2
                           :layout #'tile-left-layout)
             *root-group*)
  (add-group (create-group :name "Net" :x 0.52 :y 0.3 :w 0.4 :h 0.3) *root-group*)
  (add-group (create-group :name "The Qiv" :x 0 :y 0.4 :w 0.4 :h 0.2) (first (group-child *root-group*)))
  (add-group (create-group :x 0.4 :y 0 :w 0.2 :h 0.3) (first (group-child *root-group*)))
  (add-group (create-group :x 0.6 :y 0.4 :w 0.4 :h 0.2) (first (group-child *root-group*)))
  (add-group (create-group :x 0.4 :y 0.7 :w 0.2 :h 0.3) (first (group-child *root-group*)))
  (add-group (create-group :x 0.1 :y 0.55 :w 0.8 :h 0.43) *root-group*)
  (add-group (create-group :x 0.2 :y 0.1 :w 0.6 :h 0.4) (first (group-child *root-group*)))
  (add-group (create-group :x 0.3 :y 0.55 :w 0.4 :h 0.3) (first (group-child *root-group*)))
  (add-group (create-group :x 0.1 :y 0.1 :w 0.3 :h 0.6) 
             (first (group-child (first (group-child *root-group*)))))
  (setf *current-child* (first (group-child *current-root*)))
  (setf (group-layout *current-child*) #'tile-layout))

(setf *init-hook* #'my-init-hook)
Last modified 16 years ago Last modified on 03/01/08 00:02:29