This commit is contained in:
Kirottu
2022-12-29 23:56:32 +02:00
commit 990bf12b79
17 changed files with 2069 additions and 0 deletions

View 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"

View 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);