raffi 0.25.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
---
title: Web Search
description: Quick web searches with URL templates and keywords
---

import { Aside, Tabs, TabItem, Card, CardGrid, Steps } from '@astrojs/starlight/components';
import { Image } from 'astro:assets';
import webSearchScreenshot from '../../../assets/screenshots/web-search.png';
import fallbackScreenshot from '../../../assets/screenshots/fallbacks.png';

The native interface supports quick web searches via URL templates. Type a keyword followed by your query to open search results in your default browser.

<Aside type="note">
Web search is only available in **native mode**. It is not available when using Fuzzel mode.
</Aside>

## Overview

Define custom search engines with keywords and URL templates. When you type a keyword and query, Raffi opens your browser with the search results.

## Configuration

Configure web searches in your `raffi.yaml`:

```yaml raffi.yaml
addons:
  web_searches:
    - name: "Google"
      keyword: "g"
      url: "https://google.com/search?q={query}"
      icon: "google"

    - name: "DuckDuckGo"
      keyword: "ddg"
      url: "https://duckduckgo.com/?q={query}"
      icon: "duckduckgo"

    - name: "GitHub"
      keyword: "gh"
      url: "https://github.com/search?q={query}"
      icon: "github"

    - name: "Wikipedia"
      keyword: "wiki"
      url: "https://en.wikipedia.org/wiki/Special:Search?search={query}"
      icon: "wikipedia"
```

### Configuration Fields

**`name`** `string` (required)

Display name shown in the search row (e.g., "Search Google for...")


**`keyword`** `string` (required)

Text that activates the web search (e.g., "g", "ddg")


**`url`** `string` (required)

URL template with `{query}` placeholder for search terms


**`icon`** `string`

Icon name from your icon cache to display next to the search row


## Usage

Type a keyword followed by your search query:

```text
g rust traits
# Opens: https://google.com/search?q=rust%20traits

ddg wayland compositor
# Opens: https://duckduckgo.com/?q=wayland%20compositor

gh iced-rs
# Opens: https://github.com/search?q=iced-rs

wiki functional programming
# Opens: https://en.wikipedia.org/wiki/Special:Search?search=functional%20programming
```

<Image src={webSearchScreenshot} alt="GitHub web search with a resolved URL in the preview pane" width={800} />

## How It Works

<Steps>
1. **Type Keyword**

   Type the configured keyword followed by a space (e.g., `g `). A row naming
   the search appears while you type the keyword; Enter or Tab jumps into it.

2. **Add Query**

   Type your search query after the keyword

3. **See Preview**

   Raffi displays "Search [Name] for [query]"

4. **Execute Search**

   Press Enter to open browser with search results

</Steps>

### URL Encoding

The `{query}` placeholder is automatically percent-encoded for safe URL use:

- Spaces become `%20`
- Special characters are encoded (e.g., `&` → `%26`)
- Unreserved characters remain unchanged (A-Z, a-z, 0-9, `-`, `.`, `_`, `~`)

<Tabs>
<TabItem label="Simple Query">
```text
g hello world
→ https://google.com/search?q=hello%20world
```
</TabItem>
<TabItem label="Special Characters">
```text
g rust + traits
→ https://google.com/search?q=rust%20%2B%20traits
```
</TabItem>
<TabItem label="Complex Query">
```text
g "exact phrase" -exclude
→ https://google.com/search?q=%22exact%20phrase%22%20-exclude
```
</TabItem>
</Tabs>

## Pre-configured Search Engines

Common search engines you can add:


  <details>
<summary>General Search</summary>

    ```yaml
    - name: "Google"
      keyword: "g"
      url: "https://google.com/search?q={query}"
      icon: "google"

    - name: "DuckDuckGo"
      keyword: "ddg"
      url: "https://duckduckgo.com/?q={query}"
      icon: "duckduckgo"

    - name: "Bing"
      keyword: "b"
      url: "https://www.bing.com/search?q={query}"
      icon: "bing"
    ```
  </details>

  <details>
<summary>Development</summary>

    ```yaml
    - name: "GitHub"
      keyword: "gh"
      url: "https://github.com/search?q={query}"
      icon: "github"

    - name: "Stack Overflow"
      keyword: "so"
      url: "https://stackoverflow.com/search?q={query}"
      icon: "stackoverflow"

    - name: "Crates.io"
      keyword: "crate"
      url: "https://crates.io/search?q={query}"
      icon: "rust"

    - name: "NPM"
      keyword: "npm"
      url: "https://www.npmjs.com/search?q={query}"
      icon: "npm"

    - name: "Docker Hub"
      keyword: "docker"
      url: "https://hub.docker.com/search?q={query}"
      icon: "docker"
    ```
  </details>

  <details>
<summary>Reference</summary>

    ```yaml
    - name: "Wikipedia"
      keyword: "wiki"
      url: "https://en.wikipedia.org/wiki/Special:Search?search={query}"
      icon: "wikipedia"

    - name: "MDN"
      keyword: "mdn"
      url: "https://developer.mozilla.org/en-US/search?q={query}"
      icon: "firefox"

    - name: "Rust Docs"
      keyword: "rdoc"
      url: "https://doc.rust-lang.org/std/?search={query}"
      icon: "rust"
    ```
  </details>

  <details>
<summary>Media</summary>

    ```yaml
    - name: "YouTube"
      keyword: "yt"
      url: "https://www.youtube.com/results?search_query={query}"
      icon: "youtube"

    - name: "Reddit"
      keyword: "r"
      url: "https://www.reddit.com/search?q={query}"
      icon: "reddit"

    - name: "Twitter"
      keyword: "tw"
      url: "https://twitter.com/search?q={query}"
      icon: "twitter"
    ```
  </details>

  <details>
<summary>Shopping</summary>

    ```yaml
    - name: "Amazon"
      keyword: "amz"
      url: "https://www.amazon.com/s?k={query}"
      icon: "amazon"

    - name: "eBay"
      keyword: "ebay"
      url: "https://www.ebay.com/sch/i.html?_nkw={query}"
      icon: "ebay"
    ```
  </details>


## Custom Search Engines

You can add any search engine that accepts a query parameter:

### Finding the URL Template

<Steps>
1. **Perform a Search**

   Go to the website and search for "test"

2. **Copy URL**

   Look at the browser address bar:
       ```
       https://example.com/search?q=test
       ```

3. **Replace Query**

   Replace "test" with `{query}`:
       ```
       https://example.com/search?q={query}
       ```

4. **Add to Config**

   ```yaml
       - name: "Example"
         keyword: "ex"
         url: "https://example.com/search?q={query}"
       ```

</Steps>

### Examples

<Tabs>
<TabItem label="Site-Specific Search">
```yaml
- name: "Search Rust Reddit"
  keyword: "rr"
  url: "https://www.reddit.com/r/rust/search?q={query}&restrict_sr=1"
  icon: "reddit"
```
</TabItem>
<TabItem label="Google Images">
```yaml
- name: "Google Images"
  keyword: "img"
  url: "https://www.google.com/search?q={query}&tbm=isch"
  icon: "google"
```
</TabItem>
<TabItem label="Language-Specific">
```yaml
- name: "Python Docs"
  keyword: "pydoc"
  url: "https://docs.python.org/3/search.html?q={query}"
  icon: "python"
```
</TabItem>
</Tabs>

## Use Cases

<div class="nav-cards">
  <CardGrid>
    <Card title="Quick Research" icon="magnifier">
      ```text
      wiki quantum computing
      ```
    </Card>

    <Card title="Code Search" icon="pencil">
      ```text
      gh iced-rs
      so rust async error
      ```
    </Card>

    <Card title="Package Lookup" icon="puzzle">
      ```text
      crate serde
      npm express
      ```
    </Card>

    <Card title="Documentation" icon="document">
      ```text
      mdn fetch api
      rdoc hashmap
      ```
    </Card>
  </CardGrid>
</div>

<style>
{`
  .nav-cards a {
    text-decoration: none !important;
    color: inherit;
    display: flex;
    height: 100%;
  }
  .nav-cards article {
    flex: 1;
    transition: all 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 1px solid var(--sl-color-gray-5);
    background-color: var(--sl-color-black);
  }
  .nav-cards a article {
    cursor: pointer;
  }
  .nav-cards article .title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    font-size: 1.2rem;
  }
  .nav-cards article .title .icon {
    font-size: 2.5rem !important; /* Huge icons */
    color: var(--sl-color-purple);
    background: var(--sl-color-purple-low);
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--sl-color-purple);
  }
  .nav-cards article:hover, .nav-cards a:hover article {
    border-color: var(--sl-color-text-accent);
    background-color: var(--sl-color-gray-6);
  }
`}
</style>

### Search Fallbacks

Configure search addons as [fallbacks](../../configuration/general-settings/#fallbacks) to keep them available for arbitrary queries without typing their keyword.

<Image src={fallbackScreenshot} alt="Fallback search entries shown for a query with the selected URL preview" width={800} />

## Keyboard Shortcuts

- **Enter**: Open search in default browser
- **Esc**: Cancel and return to normal mode

## Requirements

<Aside type="caution">
Requires `xdg-open` to open URLs in your default browser (standard on most Linux distributions)
</Aside>

## Tips

<Aside type="tip">
Use short, memorable keywords like `g` for Google, `gh` for GitHub, etc.
</Aside>

<Aside type="tip">
Add site-specific searches for frequently visited websites (e.g., your company's internal docs)
</Aside>

<Aside type="tip">
You can override the query parameter name if a site uses something other than `q`: `url: "https://example.com/find?search={query}"`
</Aside>

<Aside type="tip">
Common search engines are often pre-configured in example configs. Check the Raffi repository for ready-to-use templates.
</Aside>

## Example Configuration

Here's a complete example with popular search engines:

```yaml raffi.yaml
addons:
  web_searches:
    # General
    - name: "Google"
      keyword: "g"
      url: "https://google.com/search?q={query}"
      icon: "google"

    - name: "DuckDuckGo"
      keyword: "ddg"
      url: "https://duckduckgo.com/?q={query}"

    # Development
    - name: "GitHub"
      keyword: "gh"
      url: "https://github.com/search?q={query}"
      icon: "github"

    - name: "Stack Overflow"
      keyword: "so"
      url: "https://stackoverflow.com/search?q={query}"

    - name: "Crates.io"
      keyword: "crate"
      url: "https://crates.io/search?q={query}"
      icon: "rust"

    # Reference
    - name: "Wikipedia"
      keyword: "wiki"
      url: "https://en.wikipedia.org/wiki/Special:Search?search={query}"
      icon: "wikipedia"

    - name: "MDN"
      keyword: "mdn"
      url: "https://developer.mozilla.org/en-US/search?q={query}"

    # Media
    - name: "YouTube"
      keyword: "yt"
      url: "https://www.youtube.com/results?search_query={query}"
      icon: "youtube"
```