Previous: , Up: Tutorial   [Contents][Index]


2.2.7 Example Configuration: Exit Hooks

Finally, we see the #:exit-hooks option:

(configure-device
 ...
 #:exit-hooks (list (lambda ()
                      (turn-off-ctls
                       (map control-alsa-ctl
                            (list ak1:left ak1:middle ak1:right ak1:knob))))))

Similar to #:init, #:exit-hooks takes a list of procedures. These procedures are run when Librekontrol exits. As you can see, we run the same procedure to turn off all the LEDs again. This shouldn’t be necessary, since all the LEDs should turn off after their associated control is released. Nevertheless, just to be safe, we clean up a bit.