diff --git a/Cargo.lock b/Cargo.lock index a7dfe95..c6a3c58 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -870,7 +870,7 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "owlry-plugin-api" -version = "0.4.10" +version = "1.0.0" dependencies = [ "abi_stable", "serde", @@ -878,7 +878,7 @@ dependencies = [ [[package]] name = "owlry-plugin-bookmarks" -version = "0.4.10" +version = "1.0.0" dependencies = [ "abi_stable", "dirs", @@ -890,7 +890,7 @@ dependencies = [ [[package]] name = "owlry-plugin-calculator" -version = "0.4.10" +version = "1.0.0" dependencies = [ "abi_stable", "meval", @@ -899,7 +899,7 @@ dependencies = [ [[package]] name = "owlry-plugin-clipboard" -version = "0.4.10" +version = "1.0.0" dependencies = [ "abi_stable", "owlry-plugin-api", @@ -907,7 +907,7 @@ dependencies = [ [[package]] name = "owlry-plugin-emoji" -version = "0.4.10" +version = "1.0.0" dependencies = [ "abi_stable", "owlry-plugin-api", @@ -915,7 +915,7 @@ dependencies = [ [[package]] name = "owlry-plugin-filesearch" -version = "0.4.10" +version = "1.0.0" dependencies = [ "abi_stable", "dirs", @@ -924,7 +924,7 @@ dependencies = [ [[package]] name = "owlry-plugin-media" -version = "0.4.10" +version = "1.0.0" dependencies = [ "abi_stable", "owlry-plugin-api", @@ -932,7 +932,7 @@ dependencies = [ [[package]] name = "owlry-plugin-pomodoro" -version = "0.4.10" +version = "1.0.0" dependencies = [ "abi_stable", "dirs", @@ -944,7 +944,7 @@ dependencies = [ [[package]] name = "owlry-plugin-scripts" -version = "0.4.10" +version = "1.0.0" dependencies = [ "abi_stable", "dirs", @@ -953,7 +953,7 @@ dependencies = [ [[package]] name = "owlry-plugin-ssh" -version = "0.4.10" +version = "1.0.0" dependencies = [ "abi_stable", "dirs", @@ -962,7 +962,7 @@ dependencies = [ [[package]] name = "owlry-plugin-system" -version = "0.4.10" +version = "1.0.0" dependencies = [ "abi_stable", "owlry-plugin-api", @@ -970,7 +970,7 @@ dependencies = [ [[package]] name = "owlry-plugin-systemd" -version = "0.4.10" +version = "1.0.0" dependencies = [ "abi_stable", "owlry-plugin-api", @@ -978,7 +978,7 @@ dependencies = [ [[package]] name = "owlry-plugin-weather" -version = "0.4.10" +version = "1.0.0" dependencies = [ "abi_stable", "dirs", @@ -991,7 +991,7 @@ dependencies = [ [[package]] name = "owlry-plugin-websearch" -version = "0.4.10" +version = "1.0.0" dependencies = [ "abi_stable", "owlry-plugin-api", diff --git a/crates/owlry-plugin-bookmarks/Cargo.toml b/crates/owlry-plugin-bookmarks/Cargo.toml index a7c8005..e091d05 100644 --- a/crates/owlry-plugin-bookmarks/Cargo.toml +++ b/crates/owlry-plugin-bookmarks/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "owlry-plugin-bookmarks" -version = "0.4.10" +version = "1.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/crates/owlry-plugin-bookmarks/src/lib.rs b/crates/owlry-plugin-bookmarks/src/lib.rs index 3eb5f3c..7559235 100644 --- a/crates/owlry-plugin-bookmarks/src/lib.rs +++ b/crates/owlry-plugin-bookmarks/src/lib.rs @@ -11,16 +11,16 @@ use abi_stable::std_types::{ROption, RStr, RString, RVec}; use owlry_plugin_api::{ - owlry_plugin, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, - ProviderPosition, API_VERSION, + API_VERSION, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, + ProviderPosition, owlry_plugin, }; use rusqlite::{Connection, OpenFlags}; use serde::Deserialize; use std::fs; use std::io::Write; use std::path::{Path, PathBuf}; -use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; +use std::sync::atomic::{AtomicBool, Ordering}; use std::thread; // Plugin metadata @@ -436,11 +436,7 @@ impl BookmarksState { } /// Get favicon for a URL, caching to file if needed - fn get_favicon_for_url( - conn: &Connection, - page_url: &str, - cache_dir: &Path, - ) -> Option { + fn get_favicon_for_url(conn: &Connection, page_url: &str, cache_dir: &Path) -> Option { // Check if already cached let cache_filename = Self::url_to_cache_filename(page_url); let cache_path = cache_dir.join(&cache_filename); @@ -462,9 +458,7 @@ impl BookmarksState { LIMIT 1 "#; - let data: Option> = conn - .query_row(query, [page_url], |row| row.get(0)) - .ok(); + let data: Option> = conn.query_row(query, [page_url], |row| row.get(0)).ok(); let data = data?; if data.is_empty() { @@ -638,14 +632,12 @@ mod tests { name: Some("Test Folder".to_string()), url: None, node_type: Some("folder".to_string()), - children: Some(vec![ - ChromeBookmarkNode { - name: Some("Test Bookmark".to_string()), - url: Some("https://test.com".to_string()), - node_type: Some("url".to_string()), - children: None, - }, - ]), + children: Some(vec![ChromeBookmarkNode { + name: Some("Test Bookmark".to_string()), + url: Some("https://test.com".to_string()), + node_type: Some("url".to_string()), + children: None, + }]), }; BookmarksState::process_chrome_folder_static(&folder, &mut items); diff --git a/crates/owlry-plugin-calculator/Cargo.toml b/crates/owlry-plugin-calculator/Cargo.toml index fb64561..e0c263a 100644 --- a/crates/owlry-plugin-calculator/Cargo.toml +++ b/crates/owlry-plugin-calculator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "owlry-plugin-calculator" -version = "0.4.10" +version = "1.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/crates/owlry-plugin-calculator/src/lib.rs b/crates/owlry-plugin-calculator/src/lib.rs index dc9ab19..359d32e 100644 --- a/crates/owlry-plugin-calculator/src/lib.rs +++ b/crates/owlry-plugin-calculator/src/lib.rs @@ -10,8 +10,8 @@ use abi_stable::std_types::{ROption, RStr, RString, RVec}; use owlry_plugin_api::{ - owlry_plugin, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, - ProviderPosition, API_VERSION, + API_VERSION, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, + ProviderPosition, owlry_plugin, }; // Plugin metadata diff --git a/crates/owlry-plugin-clipboard/Cargo.toml b/crates/owlry-plugin-clipboard/Cargo.toml index 4256be7..d9cd7cf 100644 --- a/crates/owlry-plugin-clipboard/Cargo.toml +++ b/crates/owlry-plugin-clipboard/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "owlry-plugin-clipboard" -version = "0.4.10" +version = "1.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/crates/owlry-plugin-clipboard/src/lib.rs b/crates/owlry-plugin-clipboard/src/lib.rs index 600e67b..b9171cb 100644 --- a/crates/owlry-plugin-clipboard/src/lib.rs +++ b/crates/owlry-plugin-clipboard/src/lib.rs @@ -9,8 +9,8 @@ use abi_stable::std_types::{ROption, RStr, RString, RVec}; use owlry_plugin_api::{ - owlry_plugin, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, - ProviderPosition, API_VERSION, + API_VERSION, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, + ProviderPosition, owlry_plugin, }; use std::process::Command; diff --git a/crates/owlry-plugin-emoji/Cargo.toml b/crates/owlry-plugin-emoji/Cargo.toml index 155fbea..4148614 100644 --- a/crates/owlry-plugin-emoji/Cargo.toml +++ b/crates/owlry-plugin-emoji/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "owlry-plugin-emoji" -version = "0.4.10" +version = "1.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/crates/owlry-plugin-emoji/src/lib.rs b/crates/owlry-plugin-emoji/src/lib.rs index 9e08045..6bcaba1 100644 --- a/crates/owlry-plugin-emoji/src/lib.rs +++ b/crates/owlry-plugin-emoji/src/lib.rs @@ -9,8 +9,8 @@ use abi_stable::std_types::{ROption, RStr, RString, RVec}; use owlry_plugin_api::{ - owlry_plugin, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, - ProviderPosition, API_VERSION, + API_VERSION, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, + ProviderPosition, owlry_plugin, }; // Plugin metadata @@ -556,10 +556,7 @@ mod tests { state.load_emojis(); // Check that items have keywords for searching - let heart = state - .items - .iter() - .find(|i| i.name.as_str() == "red heart"); + let heart = state.items.iter().find(|i| i.name.as_str() == "red heart"); assert!(heart.is_some()); } } diff --git a/crates/owlry-plugin-filesearch/Cargo.toml b/crates/owlry-plugin-filesearch/Cargo.toml index 22561de..3e41bac 100644 --- a/crates/owlry-plugin-filesearch/Cargo.toml +++ b/crates/owlry-plugin-filesearch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "owlry-plugin-filesearch" -version = "0.4.10" +version = "1.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/crates/owlry-plugin-filesearch/src/lib.rs b/crates/owlry-plugin-filesearch/src/lib.rs index 9eca26a..98e6491 100644 --- a/crates/owlry-plugin-filesearch/src/lib.rs +++ b/crates/owlry-plugin-filesearch/src/lib.rs @@ -12,8 +12,8 @@ use abi_stable::std_types::{ROption, RStr, RString, RVec}; use owlry_plugin_api::{ - owlry_plugin, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, - ProviderPosition, API_VERSION, + API_VERSION, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, + ProviderPosition, owlry_plugin, }; use std::path::Path; use std::process::Command; @@ -295,7 +295,9 @@ mod tests { // 'which' should exist on any Unix system assert!(FileSearchState::command_exists("which")); // This should not exist - assert!(!FileSearchState::command_exists("nonexistent-command-12345")); + assert!(!FileSearchState::command_exists( + "nonexistent-command-12345" + )); } #[test] diff --git a/crates/owlry-plugin-media/Cargo.toml b/crates/owlry-plugin-media/Cargo.toml index bfcc8b7..46a16f7 100644 --- a/crates/owlry-plugin-media/Cargo.toml +++ b/crates/owlry-plugin-media/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "owlry-plugin-media" -version = "0.4.10" +version = "1.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/crates/owlry-plugin-media/src/lib.rs b/crates/owlry-plugin-media/src/lib.rs index 0b064c2..9d40cd6 100644 --- a/crates/owlry-plugin-media/src/lib.rs +++ b/crates/owlry-plugin-media/src/lib.rs @@ -5,8 +5,8 @@ use abi_stable::std_types::{ROption, RStr, RString, RVec}; use owlry_plugin_api::{ - owlry_plugin, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, - ProviderPosition, API_VERSION, + API_VERSION, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, + ProviderPosition, owlry_plugin, }; use std::process::Command; @@ -14,7 +14,8 @@ use std::process::Command; const PLUGIN_ID: &str = "media"; const PLUGIN_NAME: &str = "Media Player"; const PLUGIN_VERSION: &str = env!("CARGO_PKG_VERSION"); -const PLUGIN_DESCRIPTION: &str = "MPRIS media player widget - shows and controls currently playing media"; +const PLUGIN_DESCRIPTION: &str = + "MPRIS media player widget - shows and controls currently playing media"; // Provider metadata const PROVIDER_ID: &str = "media"; diff --git a/crates/owlry-plugin-pomodoro/Cargo.toml b/crates/owlry-plugin-pomodoro/Cargo.toml index 25036ea..737b10a 100644 --- a/crates/owlry-plugin-pomodoro/Cargo.toml +++ b/crates/owlry-plugin-pomodoro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "owlry-plugin-pomodoro" -version = "0.4.10" +version = "1.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/crates/owlry-plugin-pomodoro/src/lib.rs b/crates/owlry-plugin-pomodoro/src/lib.rs index 85f4af7..2f855f7 100644 --- a/crates/owlry-plugin-pomodoro/src/lib.rs +++ b/crates/owlry-plugin-pomodoro/src/lib.rs @@ -15,8 +15,8 @@ use abi_stable::std_types::{ROption, RStr, RString, RVec}; use owlry_plugin_api::{ - notify_with_urgency, owlry_plugin, NotifyUrgency, PluginInfo, PluginItem, ProviderHandle, - ProviderInfo, ProviderKind, ProviderPosition, API_VERSION, + API_VERSION, NotifyUrgency, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, + ProviderPosition, notify_with_urgency, owlry_plugin, }; use serde::{Deserialize, Serialize}; use std::fs; @@ -51,11 +51,9 @@ impl PomodoroConfig { /// /// Reads from [plugins.pomodoro] section, with fallback to [providers] for compatibility. fn load() -> Self { - let config_path = dirs::config_dir() - .map(|d| d.join("owlry").join("config.toml")); + let config_path = dirs::config_dir().map(|d| d.join("owlry").join("config.toml")); - let config_content = config_path - .and_then(|p| fs::read_to_string(p).ok()); + let config_content = config_path.and_then(|p| fs::read_to_string(p).ok()); if let Some(content) = config_content && let Ok(toml) = content.parse::() @@ -81,7 +79,10 @@ impl PomodoroConfig { .map(|v| v as u32) .unwrap_or(DEFAULT_BREAK_MINS); - return Self { work_mins, break_mins }; + return Self { + work_mins, + break_mins, + }; } } @@ -106,7 +107,10 @@ impl PomodoroConfig { .map(|v| v as u32) .unwrap_or(DEFAULT_BREAK_MINS); - Self { work_mins, break_mins } + Self { + work_mins, + break_mins, + } } } diff --git a/crates/owlry-plugin-scripts/Cargo.toml b/crates/owlry-plugin-scripts/Cargo.toml index d20bf41..cee1061 100644 --- a/crates/owlry-plugin-scripts/Cargo.toml +++ b/crates/owlry-plugin-scripts/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "owlry-plugin-scripts" -version = "0.4.10" +version = "1.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/crates/owlry-plugin-scripts/src/lib.rs b/crates/owlry-plugin-scripts/src/lib.rs index c49efa4..090d14c 100644 --- a/crates/owlry-plugin-scripts/src/lib.rs +++ b/crates/owlry-plugin-scripts/src/lib.rs @@ -12,8 +12,8 @@ use abi_stable::std_types::{ROption, RStr, RString, RVec}; use owlry_plugin_api::{ - owlry_plugin, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, - ProviderPosition, API_VERSION, + API_VERSION, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, + ProviderPosition, owlry_plugin, }; use std::fs; use std::os::unix::fs::PermissionsExt; @@ -132,7 +132,11 @@ impl ScriptsState { // Look for a comment description if let Some(desc) = check_line.strip_prefix("# ") { Some(desc.trim().to_string()) - } else { check_line.strip_prefix("// ").map(|desc| desc.trim().to_string()) } + } else { + check_line + .strip_prefix("// ") + .map(|desc| desc.trim().to_string()) + } } fn determine_icon(path: &PathBuf) -> String { @@ -150,17 +154,18 @@ impl ScriptsState { // Check shebang if let Ok(content) = fs::read_to_string(path) - && let Some(first_line) = content.lines().next() { - if first_line.contains("bash") || first_line.contains("sh") { - return "utilities-terminal".to_string(); - } else if first_line.contains("python") { - return "text-x-python".to_string(); - } else if first_line.contains("node") { - return "text-x-javascript".to_string(); - } else if first_line.contains("ruby") { - return "text-x-ruby".to_string(); - } + && let Some(first_line) = content.lines().next() + { + if first_line.contains("bash") || first_line.contains("sh") { + return "utilities-terminal".to_string(); + } else if first_line.contains("python") { + return "text-x-python".to_string(); + } else if first_line.contains("node") { + return "text-x-javascript".to_string(); + } else if first_line.contains("ruby") { + return "text-x-ruby".to_string(); } + } "application-x-executable".to_string() } diff --git a/crates/owlry-plugin-ssh/Cargo.toml b/crates/owlry-plugin-ssh/Cargo.toml index 37baf01..5bf94a0 100644 --- a/crates/owlry-plugin-ssh/Cargo.toml +++ b/crates/owlry-plugin-ssh/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "owlry-plugin-ssh" -version = "0.4.10" +version = "1.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/crates/owlry-plugin-ssh/src/lib.rs b/crates/owlry-plugin-ssh/src/lib.rs index 01e889b..26edf99 100644 --- a/crates/owlry-plugin-ssh/src/lib.rs +++ b/crates/owlry-plugin-ssh/src/lib.rs @@ -9,8 +9,8 @@ use abi_stable::std_types::{ROption, RStr, RString, RVec}; use owlry_plugin_api::{ - owlry_plugin, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, - ProviderPosition, API_VERSION, + API_VERSION, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, + ProviderPosition, owlry_plugin, }; use std::fs; use std::path::PathBuf; @@ -40,8 +40,7 @@ struct SshState { impl SshState { fn new() -> Self { // Try to detect terminal from environment, fall back to default - let terminal = std::env::var("TERMINAL") - .unwrap_or_else(|_| DEFAULT_TERMINAL.to_string()); + let terminal = std::env::var("TERMINAL").unwrap_or_else(|_| DEFAULT_TERMINAL.to_string()); Self { items: Vec::new(), @@ -167,13 +166,9 @@ impl SshState { // Wrap in terminal let command = format!("{} -e {}", self.terminal_command, ssh_command); - let mut item = PluginItem::new( - format!("ssh:{}", host), - format!("SSH: {}", host), - command, - ) - .with_icon(PROVIDER_ICON) - .with_keywords(vec!["ssh".to_string(), "remote".to_string()]); + let mut item = PluginItem::new(format!("ssh:{}", host), format!("SSH: {}", host), command) + .with_icon(PROVIDER_ICON) + .with_keywords(vec!["ssh".to_string(), "remote".to_string()]); if let Some(desc) = description { item = item.with_description(desc); @@ -313,7 +308,10 @@ mod tests { state.add_host_item("test", None, None, None); assert!(state.items[0].icon.is_some()); - assert_eq!(state.items[0].icon.as_ref().unwrap().as_str(), PROVIDER_ICON); + assert_eq!( + state.items[0].icon.as_ref().unwrap().as_str(), + PROVIDER_ICON + ); } #[test] diff --git a/crates/owlry-plugin-system/Cargo.toml b/crates/owlry-plugin-system/Cargo.toml index acad3bd..8ecde43 100644 --- a/crates/owlry-plugin-system/Cargo.toml +++ b/crates/owlry-plugin-system/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "owlry-plugin-system" -version = "0.4.10" +version = "1.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/crates/owlry-plugin-system/src/lib.rs b/crates/owlry-plugin-system/src/lib.rs index f68e4f7..5e5b3e9 100644 --- a/crates/owlry-plugin-system/src/lib.rs +++ b/crates/owlry-plugin-system/src/lib.rs @@ -13,8 +13,8 @@ use abi_stable::std_types::{ROption, RStr, RString, RVec}; use owlry_plugin_api::{ - owlry_plugin, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, - ProviderPosition, API_VERSION, + API_VERSION, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, + ProviderPosition, owlry_plugin, }; // Plugin metadata @@ -221,7 +221,10 @@ mod tests { .find(|i| i.name.as_str() == "Reboot into BIOS") .expect("Reboot into BIOS should exist"); - assert_eq!(bios_cmd.command.as_str(), "systemctl reboot --firmware-setup"); + assert_eq!( + bios_cmd.command.as_str(), + "systemctl reboot --firmware-setup" + ); } #[test] diff --git a/crates/owlry-plugin-systemd/Cargo.toml b/crates/owlry-plugin-systemd/Cargo.toml index b725f1f..28ef98b 100644 --- a/crates/owlry-plugin-systemd/Cargo.toml +++ b/crates/owlry-plugin-systemd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "owlry-plugin-systemd" -version = "0.4.10" +version = "1.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/crates/owlry-plugin-systemd/src/lib.rs b/crates/owlry-plugin-systemd/src/lib.rs index 25b0afa..f12f489 100644 --- a/crates/owlry-plugin-systemd/src/lib.rs +++ b/crates/owlry-plugin-systemd/src/lib.rs @@ -10,8 +10,8 @@ use abi_stable::std_types::{ROption, RStr, RString, RVec}; use owlry_plugin_api::{ - owlry_plugin, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, - ProviderPosition, API_VERSION, + API_VERSION, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, + ProviderPosition, owlry_plugin, }; use std::process::Command; @@ -67,7 +67,8 @@ impl SystemdState { self.items = Self::parse_systemctl_output(&stdout); // Sort by name - self.items.sort_by(|a, b| a.name.as_str().cmp(b.name.as_str())); + self.items + .sort_by(|a, b| a.name.as_str().cmp(b.name.as_str())); } fn systemctl_available() -> bool { @@ -154,7 +155,11 @@ impl SystemdState { /// Generate submenu actions for a given service /// This function is called by the core when a service is selected -pub fn actions_for_service(unit_name: &str, display_name: &str, is_active: bool) -> Vec { +pub fn actions_for_service( + unit_name: &str, + display_name: &str, + is_active: bool, +) -> Vec { let mut actions = Vec::new(); if is_active { @@ -380,11 +385,21 @@ baz@autostart.service loaded active running Baz App // Check first item assert_eq!(items[0].name.as_str(), "foo"); - assert!(items[0].command.as_str().contains("SUBMENU:uuctl:foo.service:true")); + assert!( + items[0] + .command + .as_str() + .contains("SUBMENU:uuctl:foo.service:true") + ); // Check second item (inactive) assert_eq!(items[1].name.as_str(), "bar"); - assert!(items[1].command.as_str().contains("SUBMENU:uuctl:bar.service:false")); + assert!( + items[1] + .command + .as_str() + .contains("SUBMENU:uuctl:bar.service:false") + ); // Check third item (cleaned name) assert_eq!(items[2].name.as_str(), "baz"); @@ -429,12 +444,17 @@ baz@autostart.service loaded active running Baz App #[test] fn test_submenu_query() { // Test that provider_query handles ?SUBMENU: queries correctly - let handle = ProviderHandle { ptr: std::ptr::null_mut() }; + let handle = ProviderHandle { + ptr: std::ptr::null_mut(), + }; // Query for active service let query = RStr::from_str("?SUBMENU:test.service:true"); let actions = provider_query(handle, query); - assert!(!actions.is_empty(), "Should return actions for submenu query"); + assert!( + !actions.is_empty(), + "Should return actions for submenu query" + ); // Should have restart action for active service let has_restart = actions.iter().any(|a| a.id.as_str().contains(":restart:")); @@ -443,7 +463,10 @@ baz@autostart.service loaded active running Baz App // Query for inactive service let query = RStr::from_str("?SUBMENU:test.service:false"); let actions = provider_query(handle, query); - assert!(!actions.is_empty(), "Should return actions for submenu query"); + assert!( + !actions.is_empty(), + "Should return actions for submenu query" + ); // Should have start action for inactive service let has_start = actions.iter().any(|a| a.id.as_str().contains(":start:")); diff --git a/crates/owlry-plugin-weather/Cargo.toml b/crates/owlry-plugin-weather/Cargo.toml index 0a103f3..0d924bb 100644 --- a/crates/owlry-plugin-weather/Cargo.toml +++ b/crates/owlry-plugin-weather/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "owlry-plugin-weather" -version = "0.4.10" +version = "1.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/crates/owlry-plugin-weather/src/lib.rs b/crates/owlry-plugin-weather/src/lib.rs index 0f3edc7..a74e86a 100644 --- a/crates/owlry-plugin-weather/src/lib.rs +++ b/crates/owlry-plugin-weather/src/lib.rs @@ -20,8 +20,8 @@ use abi_stable::std_types::{ROption, RStr, RString, RVec}; use owlry_plugin_api::{ - owlry_plugin, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, - ProviderPosition, API_VERSION, + API_VERSION, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, + ProviderPosition, owlry_plugin, }; use serde::{Deserialize, Serialize}; use std::fs; @@ -77,11 +77,9 @@ impl WeatherConfig { /// /// Reads from [plugins.weather] section, with fallback to [providers] for compatibility. fn load() -> Self { - let config_path = dirs::config_dir() - .map(|d| d.join("owlry").join("config.toml")); + let config_path = dirs::config_dir().map(|d| d.join("owlry").join("config.toml")); - let config_content = config_path - .and_then(|p| fs::read_to_string(p).ok()); + let config_content = config_path.and_then(|p| fs::read_to_string(p).ok()); if let Some(content) = config_content && let Ok(toml) = content.parse::() @@ -253,10 +251,11 @@ impl WeatherState { fn refresh(&mut self) { // Use cache if still valid (works across app restarts) if self.is_cache_valid() - && let Some(data) = self.cached_data.clone() { - self.generate_items(&data); - return; - } + && let Some(data) = self.cached_data.clone() + { + self.generate_items(&data); + return; + } // Fetch new data from API if let Some(data) = self.fetch_weather() { @@ -395,9 +394,10 @@ impl WeatherState { && let (Ok(lat), Ok(lon)) = ( parts[0].trim().parse::(), parts[1].trim().parse::(), - ) { - return Some((lat, lon, location.clone())); - } + ) + { + return Some((lat, lon, location.clone())); + } } // Use Open-Meteo geocoding API @@ -518,9 +518,10 @@ impl WeatherState { details.push(format!("Wind {} km/h", wind.round() as i32)); } if let Some(feels) = data.feels_like - && (feels - data.temperature).abs() > 2.0 { - details.push(format!("Feels like {}°C", feels.round() as i32)); - } + && (feels - data.temperature).abs() > 2.0 + { + details.push(format!("Feels like {}°C", feels.round() as i32)); + } let encoded_location = data.location.replace(' ', "+"); let command = format!("xdg-open 'https://wttr.in/{}'", encoded_location); diff --git a/crates/owlry-plugin-websearch/Cargo.toml b/crates/owlry-plugin-websearch/Cargo.toml index 25b2136..d0f6fbf 100644 --- a/crates/owlry-plugin-websearch/Cargo.toml +++ b/crates/owlry-plugin-websearch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "owlry-plugin-websearch" -version = "0.4.10" +version = "1.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/crates/owlry-plugin-websearch/src/lib.rs b/crates/owlry-plugin-websearch/src/lib.rs index 66cf00f..8de6b85 100644 --- a/crates/owlry-plugin-websearch/src/lib.rs +++ b/crates/owlry-plugin-websearch/src/lib.rs @@ -10,8 +10,8 @@ use abi_stable::std_types::{ROption, RStr, RString, RVec}; use owlry_plugin_api::{ - owlry_plugin, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, - ProviderPosition, API_VERSION, + API_VERSION, PluginInfo, PluginItem, ProviderHandle, ProviderInfo, ProviderKind, + ProviderPosition, owlry_plugin, }; // Plugin metadata @@ -231,10 +231,7 @@ mod tests { WebSearchState::extract_search_term("? rust programming"), Some("rust programming") ); - assert_eq!( - WebSearchState::extract_search_term("?rust"), - Some("rust") - ); + assert_eq!(WebSearchState::extract_search_term("?rust"), Some("rust")); assert_eq!( WebSearchState::extract_search_term("web rust docs"), Some("rust docs")