Anyrun!
This commit is contained in:
13
plugins/web-search/Cargo.toml
Normal file
13
plugins/web-search/Cargo.toml
Normal file
@@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "web-search"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
anyrun-plugin = { path = "../../anyrun-plugin" }
|
||||
abi_stable = "0.11.1"
|
35
plugins/web-search/src/lib.rs
Normal file
35
plugins/web-search/src/lib.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
use abi_stable::std_types::{ROption, RString, RVec};
|
||||
use anyrun_plugin::{plugin, anyrun_interface::HandleResult, Match, PluginInfo};
|
||||
|
||||
pub fn init(_config_dir: RString) {}
|
||||
|
||||
pub fn info() -> PluginInfo {
|
||||
PluginInfo {
|
||||
name: "Web search".into(),
|
||||
icon: "system-search".into(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_matches(input: RString) -> RVec<Match> {
|
||||
vec![
|
||||
Match {
|
||||
title: "DDG it!".into(),
|
||||
description: ROption::RSome(format!(r#"Look up "{}" with DuckDuckGo"#, input).into()),
|
||||
icon: "emblem-web".into(),
|
||||
id: 0,
|
||||
},
|
||||
Match {
|
||||
title: "Startpage it!".into(),
|
||||
description: ROption::RSome(format!(r#"Look up "{}" with Startpage"#, input).into()),
|
||||
icon: "emblem-web".into(),
|
||||
id: 0,
|
||||
},
|
||||
]
|
||||
.into()
|
||||
}
|
||||
|
||||
pub fn handler(selection: Match) -> HandleResult {
|
||||
HandleResult::Close
|
||||
}
|
||||
|
||||
plugin!(init, info, get_matches, handler);
|
Reference in New Issue
Block a user