raffi 0.24.0

A simple fuzzel launcher based on YAML file
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
---
title: YAML Configuration Schema
description: Complete reference for raffi.yaml configuration structure
---

Raffi uses a YAML configuration file to define launcher entries and settings. The default location is `~/.config/raffi/raffi.yaml`.

## Top-Level Structure

The configuration file consists of three main sections:

```yaml
version: 1

general:
  # General settings and UI configuration

addons:
  # Addon configurations (currency, calculator, etc.)

# Entry definitions (each key becomes an entry)
launchers:
  entry_name:
    binary: command
    description: "Display name"
    # ... other entry fields
```

## General Section

Persistent defaults for UI and behavior. All fields are optional and can be overridden by command-line flags.

**`general.ui_type`** `string` (default: `fuzzel`)

Default UI backend to use.

  Valid values: `fuzzel`, `native`

  ```yaml
  general:
    ui_type: native

```


**`general.default_script_shell`** `string` (default: `bash`)

Default interpreter for script entries.

  Used when an entry has a `script` field but no explicit `binary` field.

  ```yaml
  general:
    default_script_shell: /bin/zsh

```


**`general.no_icons`** `boolean` (default: `false`)

Disable icon loading globally.

  ```yaml
  general:
    no_icons: true

```


**`general.theme`** `string` (default: `dark`)

Color theme for native UI.

  Valid values: `dark`, `light`

  ```yaml
  general:
    theme: light

```


**`general.max_history`** `number` (default: `10`)

Maximum number of search query history entries to keep.

  Set to `0` to disable history. Navigate history with Alt+P (previous) and Alt+N (next) in native mode.

  ```yaml
  general:
    max_history: 20

```


**`general.font_size`** `number` (default: `20`)

Base font size in pixels for native UI.

  Other UI elements scale proportionally:

- Input text: 1.2× base size (24px by default)
- Item text: 1.0× base size (20px by default)
- Subtitle text: 0.7× base size (14px by default)
- Hint text: 0.6× base size (12px by default)

  ```yaml
  general:
    font_size: 16

```


**`general.font_family`** `string` (default: `system sans-serif`)

Font family name for native UI.

  ```yaml
  general:
    font_family: "Inter"

```


**`general.window_width`** `number` (default: `800`)

Window width in pixels for native UI.

  ```yaml
  general:
    window_width: 900

```


**`general.window_height`** `number` (default: `600`)

Window height in pixels for native UI.

  ```yaml
  general:
    window_height: 500

```


**`general.padding`** `number` (default: `20`)

Outer window padding in pixels for native UI.

  By default, scales automatically with `font_size`. Set explicitly to override.

  ```yaml
  general:
    padding: 30

```


**`general.fallbacks`** `list of strings` (default: `[]`)

Addon entries shown at the bottom of the launcher list when typing a non-empty query. Useful for search-type addons (web searches, script filters).

  Format: `addons.<type>."<name>"` where `<type>` is `web_searches` or `script_filters`.

  ```yaml
  general:
    fallbacks:
      - addons.web_searches."Google"
      - addons.script_filters."Search DuckDuckGo"

```


**`general.theme_colors`** `object`

Custom color overrides for the native UI theme.

  Each field accepts a hex color string: `#RGB`, `#RRGGBB`, or `#RRGGBBAA`. Only specified colors are overridden; others use the base theme defaults.

  Available color keys:

- `bg_base` - Main background color
- `bg_input` - Input field background
- `accent` - Accent color (selected items, borders)
- `accent_hover` - Hover state for accented elements
- `text_main` - Primary text color
- `text_muted` - Secondary/muted text color
- `selection_bg` - Selected item background
- `border` - Border color

  ```yaml
  general:
    theme: dark
    theme_colors:
      bg_base: "#1e1e2e"
      bg_input: "#313244"
      accent: "#cba6f7"
      accent_hover: "#89b4fa"
      text_main: "#cdd6f4"
      text_muted: "#6c7086"
      selection_bg: "#45475a"
      border: "#585b70"

```


## Entry Fields

Each key under `launchers` defines a launcher entry.

**`binary`** `string` (optional)

The executable command to run.

  If the binary is not found in `$PATH`, the entry is automatically hidden.

  ```yaml
  launchers:
    firefox:
      binary: firefox
      description: "Firefox Browser"

```


**`description`** `string`

Display name shown in the launcher.

  If omitted, the entry key or binary name is used.

  ```yaml
  launchers:
    firefox:
      binary: firefox
      description: "Firefox Browser"

```


**`args`** `array[string]`

Command-line arguments to pass to the binary.

  Supports tilde and environment variable expansion.

  ```yaml
  launchers:
    firefox:
      binary: firefox
      args: ["--marionette", "--private-window"]
      description: "Firefox Private"

```


**`icon`** `string`

Icon name resolved from system icon directories (`$XDG_DATA_DIRS/icons`, `$XDG_DATA_DIRS/pixmaps`). Prefers larger icons (48×48+) as Raffi renders at 48×48. Supports PNG and SVG formats.

  ```yaml
  launchers:
    firefox:
      binary: firefox
      icon: firefox
      description: "Firefox"

```


**`script`** `string`

Inline script content to execute.

  When present, the `binary` field specifies the interpreter (defaults to `bash` or the value of `--default-script-shell`). The `args` field can provide arguments to the interpreter.

  Script expansion (`~/` and `${VAR}`) is **not** performed on the script content itself.

  ```yaml
  launchers:
    hello_script:
      script: |
        echo "Hello, world!"
        date
      description: "Hello Script"

    python_script:
      binary: python3
      script: |
        import datetime
        print(f"Current time: {datetime.datetime.now()}")
      description: "Python Time"

```


**`disabled`** `boolean` (default: `false`)

Hide this entry from the launcher.

  ```yaml
  launchers:
    experimental_feature:
      binary: experimental
      description: "Experimental Feature"
      disabled: true

```


### Conditional Display

Entries can be conditionally shown based on environment variables or file existence. Multiple conditions can be specified per entry — when present, they are AND-ed together (all must pass).

**`ifenveq`** `array[string]`

Show entry only if an environment variable equals a specific value.

  Must be an array with exactly two elements: `[VARIABLE_NAME, expected_value]`

  ```yaml
  launchers:
    gnome_settings:
      binary: gnome-control-center
      description: "Settings"
      ifenveq: [DESKTOP_SESSION, GNOME]

```


**`ifenvset`** `string`

Show entry only if the specified environment variable is set (to any value).

  ```yaml
  launchers:
    wayland_tool:
      binary: some-wayland-tool
      description: "Wayland Tool"
      ifenvset: WAYLAND_DISPLAY

```


**`ifenvnotset`** `string`

Show entry only if the specified environment variable is **not** set.

  ```yaml
  launchers:
    x11_only:
      binary: some-x11-tool
      description: "X11 Tool"
      ifenvnotset: WAYLAND_DISPLAY

```


**`ifexist`** `string`

Show entry only if the specified binary exists in `$PATH`.

  ```yaml
  launchers:
    spotify:
      binary: spotify
      description: "Spotify"
      ifexist: spotify

```


## Addons Section

The `addons` section configures built-in addons for the native UI. See [Addon Configuration](/reference/addon-configuration) for detailed documentation.

```yaml
addons:
  currency:
    enabled: true
  calculator:
    enabled: true
  file_browser:
    enabled: true
  script_filters: []
  web_searches: []
  text_snippets: []
```

## Validation

Raffi generates a JSON Schema for this format and keeps a copy named `raffi-schema.json` next to your config file. The copy is rewritten whenever it no longer matches the running version of Raffi.

Point your editor at it by adding this line at the top of `raffi.yaml` (supported by any editor using [yaml-language-server](https://github.com/redhat-developer/yaml-language-server)):

```yaml
# yaml-language-server: $schema=raffi-schema.json
```

Unknown keys (a typo such as `binnary:`) and wrong value types are then flagged while you edit.

Raffi also validates the config every time it loads it. Problems are printed to stderr as warnings and Raffi keeps running, ignoring unknown keys as before:

```
raffi: config warning: /home/user/.config/raffi/raffi.yaml:12: /launchers/firefox: Additional properties are not allowed ('binnary' was unexpected)
```

To check a config explicitly, for example in a script or after editing, run `raffi --check-config`. It prints all problems and exits with a non-zero status if any were found.

The startup warnings and `--check-config` need the `config-validation` Cargo feature, which is enabled by default. Minimal `--no-default-features` builds skip them, though the schema file is still written for your editor.

## Path Expansion

Most configuration fields (except `script`) support path and variable expansion:

- `~/` expands to `$HOME`
- `${VAR}` expands to the value of environment variable `VAR` (empty string if unset)

```yaml
launchers:
  myapp:
    binary: ${HOME}/bin/myapp
    args: ["${XDG_DATA_HOME}/files", "~/Documents"]
    icon: ~/icons/myapp.png
    ifexist: ~/bin/myapp
```

## Complete Example

```yaml
version: 1

general:
  ui_type: native
  theme: dark
  font_size: 20
  font_family: "Inter"
  window_width: 800
  window_height: 600
  max_history: 10
  default_script_shell: bash
  theme_colors:
    accent: "#cba6f7"

addons:
  currency:
    enabled: true
    trigger: "$"
    default_currency: USD
  calculator:
    enabled: true
  file_browser:
    enabled: true
    show_hidden: false
  web_searches:
    - name: "Google"
      keyword: "g"
      url: "https://google.com/search?q={query}"
      icon: "google"

launchers:
  firefox:
    binary: firefox
    args: ["--marionette"]
    icon: firefox
    description: "Firefox Browser"

  thunder:
    binary: thunar
    args: ["~/Downloads/"]
    description: "File Manager"

  hello_script:
    script: |
      echo "Hello, world!"
      date
    description: "Hello Script"
    icon: "script"

  gnome_settings:
    binary: gnome-control-center
    description: "System Settings"
    icon: preferences-system
    ifenveq: [DESKTOP_SESSION, GNOME]

  suspend:
    binary: systemctl
    args: [suspend]
    description: "Suspend/Sleep"
    icon: system-suspend
```