Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions plugins/websearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,27 @@ Config(
// Custom(
// name: "Searx",
// url: "searx.be/?q={}",
// icon: Some("/path/to/icon.png"), //can be left out entirely
// )
//
// NOTE: `{}` is replaced by the search query and `https://` is automatically added in front.
engines: [Google]
)
```

### Icons

The Custom engine icon can be one of:

- an icon name supported by your theme:
```ron
Some("view-more-symbolic")
```
- an icon name from the [freedesktop.org icon naming spec](https://specifications.freedesktop.org/icon-naming/latest/):
```ron
Some("help-about")
```
- an absolute path to an icon, e.g.
```ron
Some("/absolute/path/to/icon.png")
```
12 changes: 10 additions & 2 deletions plugins/websearch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ enum Engine {
Ecosia,
Bing,
DuckDuckGo,
Custom { name: String, url: String },
Custom {
name: String,
url: String,
#[serde(default)]
icon: Option<String>,
},
}

impl Engine {
Expand Down Expand Up @@ -81,7 +86,10 @@ fn get_matches(input: RString, config: &Config) -> RVec<Match> {
title: input.trim_start_matches(&config.prefix).into(),
description: ROption::RSome(format!("Search with {}", engine).into()),
use_pango: false,
icon: ROption::RNone,
icon: match engine {
Engine::Custom { icon: Some(i), .. } => ROption::RSome(i.clone().into()),
_ => ROption::RNone,
},
id: ROption::RSome(i as u64),
})
.collect()
Expand Down
Loading