Skip to content

bintracker-core

[module] bintracker-core

This module controls the main application process.

Global Actions

[procedure] (load-config)

Load and evaluate the main configuration file config/config.scm.

[procedure] (info . ARGS)

Core GUI Layout

[procedure] (init-main-menu)

Initialize the main menu.

[procedure] (init-top-level-layout)

Bindings

[procedure] (update-global-key-bindings!)

Update the key bindings, as specified in the current keymap setting.

Plugins

[procedure] (check-required-plugin-version NEED HAVE)

Check if the plugin version HAVE meets the version requirement NEED. See plugins for details.

[variable] plugins

default:

(letrec*
    ((registry '())
     (read-plugin-file
      (lambda (name #!optional version-req)
        (or (apply register-plugin
               (cons version-req
                 (call-with-input-file
                 (string-append "plugins/" name "/" name ".scm")
                   read)))
        (error "Something went wrong."))))
     (register-plugin
      (lambda (version-req header
                   #!key id version author license (description "")
                   (dependencies '()) body)
        (and-let* ((_ (eqv? header 'bintracker-plugin))
               (_ (or (not version-req)
                  (check-required-plugin-version version-req
                                 version)))
               (id id)
               (version version)
               (_ (andmap (lambda (dep)
                    (or (member (car dep) (map car registry))
                    (apply read-plugin-file dep)))
                  dependencies)))
          (map eval body)
          (set! registry
        (cons (list id version author license description)
              registry))
          #t))))
      (lambda args
    (if (null? args)
        registry
        (case (car args)
          ((register)
           (for-each
        (lambda (name)
          (unless (member name (map car registry))
            (handle-exceptions
            exn
            (error 'plugins
                   (string-append
                "Failed to register plugin " name ", reason: "
                (->string exn)))
              (read-plugin-file name))))
        (string-split (cadr args))))
          (else (error 'plugins (string-append "Unknown command "
                           (->string args))))))))

This is Bintracker's plugin registry. When calling this procedure without any arguments, it returns the list of currently loaded plugins. To load a new plugin, call it as follows:

(plugins 'register NAME)

where NAME is the name of a plugin in the plugins directory. See the manual chapter on writing plugins for further details.

Startup Hooks

[variable] after-startup-hooks

default: (make-hooks(init-focus . ,(lambda () (focus 'resume))))`
The set of hooks that will be executed immediately after startup.

[variable] on-startup-hooks

default:

(make-hooks
     `(load-config . ,load-config)
     `(init-main-menu . ,init-main-menu)
     `(init-db . ,btdb-init!)
     `(update-style . ,update-ttk-style)
     `(update-global-key-bindings . ,update-global-key-bindings!)
     `(update-window-title . ,update-window-title!)
     `(maybe-show-menu
       . ,(lambda ()
        (when (settings 'show-menu)
          (tk 'configure 'menu: (menu-widget (state 'menu))))))
     `(init-top-level-layout . ,init-top-level-layout)
     `(add-size-grip . ,add-size-grip)
     `(disable-keyboard-traversal . ,disable-keyboard-traversal)
     `(run-post-startup . ,(lambda () (after-startup-hooks 'execute))))

The list of hooks that will be executed on startup.