improv: desktop entries update

This commit is contained in:
wiiznokes 2024-07-13 01:13:17 +02:00 • committed by GitHub
parent ab7a71a057
commit 172532056b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 559 additions and 663 deletions

View file

@ -225,7 +225,6 @@ impl<O: futures::Sink<Response> + Unpin> Service<O> {
})
.await;
}
// Report the plugin as finished and remove it from future polling
PluginResponse::Deactivate => {
self.finished(plugin).await;

View file

@ -91,7 +91,7 @@ impl Default for PluginPriority {
}
pub fn load(source: &Path, config_path: &Path) -> Option<(PathBuf, PluginConfig, Option<Regex>)> {
if let Ok(config_bytes) = std::fs::read_to_string(&config_path) {
if let Ok(config_bytes) = std::fs::read_to_string(config_path) {
let config = match ron::from_str::<PluginConfig>(&config_bytes) {
Ok(config) => config,
Err(why) => {
@ -114,11 +114,7 @@ pub fn load(source: &Path, config_path: &Path) -> Option<(PathBuf, PluginConfig,
return None;
};
let regex = config
.query
.regex
.as_ref()
.and_then(|p| Regex::new(&*p).ok());
let regex = config.query.regex.as_ref().and_then(|p| Regex::new(p).ok());
return Some((exec, config, regex));
}

View file

@ -110,10 +110,9 @@ impl ExternalPlugin {
futures::pin_mut!(responder);
futures::pin_mut!(trip);
let _ = futures::future::select(responder, trip)
futures::future::select(responder, trip)
.await
.factor_first()
.0;
.factor_first();
// Ensure that a task that was searching sends a finished signal if it dies.
if searching.swap(false, Ordering::SeqCst) {
@ -161,7 +160,7 @@ impl ExternalPlugin {
if let Some(stdin) = child.stdin.as_mut() {
if let Ok(mut serialized) = serde_json::to_vec(event) {
serialized.push(b'\n');
let _ = stdin.write_all(&serialized).await?;
stdin.write_all(&serialized).await?;
tracing::debug!("{}: sent message to external process", self.name());
}

View file

@ -5,8 +5,6 @@ pub mod config;
pub(crate) mod external;
pub mod help;
pub use external::load;
pub use self::config::{PluginConfig, PluginPriority, PluginQuery};
pub use self::external::ExternalPlugin;
pub use self::help::HelpPlugin;

View file

@ -48,7 +48,9 @@ impl PartialEq for Priority {
impl Eq for Priority {}
impl PartialOrd for Priority {
#[allow(clippy::non_canonical_partial_ord_impl)]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
// todo: what is going on here ?
(
other.plugin_priority,
self.compute_value(other),