Next: , Previous: , Up: API  


1.16 (heks-linux prelude)

1.16.1 Procedures

Procedure: G_ msg

Translate msg using the current text domain.

(G_ "Hello")
Procedure: flatten-list xs

Recursively flatten a nested list structure xs into a single flat list.

(flatten-list '(1 (2 (3 4)) 5))
⇒ (1 2 3 4 5)
Procedure: install-config-file! KEY: #:name #:dir #:contents

Write contents to a file named name inside directory dir. If dir does not exist, it will be created automatically.

(install-config-file! #:name "config.toml"
                      #:dir "/etc/myapp"
                      #:contents "[settings]
port = 8080")
Procedure: mk-css-conf-lines pairs

Format an association list of pairs into a CSS ruleset string.

(mk-css-conf-lines '((body (color . "black") (margin . 0))))
⇒ "body {
  color: black;
  margin: 0;
}
"
Procedure: mk-kv-conf-lines pairs KEY: #:template

Format an association list of pairs into configuration lines using template.

(mk-kv-conf-lines '((host . "localhost") (port . 80)))
⇒ "host=localhost
port=80
"
Procedure: mk-lines items

Join a list of items into a single string, appending a newline to each item.

(mk-lines '("foo" "bar"))
⇒ "foo
bar
"
Procedure: mk-rec-kv-conf-lines pairs KEY: #:template

Recursively format nested configuration pairs into a string using template. This handles both top-level key-values and nested blocks as INI-style sections.

(mk-rec-kv-conf-lines '((settings (port . 8080))) #:template "~a=~a
")
⇒ "
[settings]
port=8080
"
Procedure: nix-profile-install x

Install the Nix package specified by the attribute path x via system call.

(nix-profile-install "nixpkgs.tmux")
Procedure: serialize-rec-conf-item template item

Serialize a single configuration item using template to the current output port. If the item’s value is a list, it formats the key as an INI-style section header.

(with-output-to-string
  (lambda () (serialize-rec-conf-item "~a=~a
" '(port . 80))))
⇒ "port=80
"
Procedure: setup-i18n

Initialize internationalization (i18n) locales and text domains for the application. Safely catches and logs errors if initialization fails.

Procedure: syscall cmd KEY: #:silent?

Execute the system command cmd via an input pipe and return its stdout. If silent? is true, the output is also printed to the current output port.

(syscall "echo 'hello'")
⇒ "hello
"

1.16.2 Variables

Variable: css-conf-pair
"  ~a: ~a;\n"
Variable: equal-conf-pair
"~a=~a\n"
Variable: equal-conf-quote-value-pair
"~a=\"~a\"\n"
Variable: spaced-conf-pair
"~a ~a\n"
Variable: spaced-equal-conf-pair
"~a = ~a\n"

Next: (heks-linux rofi), Previous: (heks-linux palette), Up: API