chore: format, fix clippy warnings, bump all plugins to 1.0.0

This commit is contained in:
2026-03-26 13:37:56 +01:00
parent 088664aefd
commit f8bced5a84
27 changed files with 152 additions and 129 deletions

28
Cargo.lock generated
View File

@@ -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",

View File

@@ -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

View File

@@ -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<String> {
fn get_favicon_for_url(conn: &Connection, page_url: &str, cache_dir: &Path) -> Option<String> {
// 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<Vec<u8>> = conn
.query_row(query, [page_url], |row| row.get(0))
.ok();
let data: Option<Vec<u8>> = 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);

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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;

View File

@@ -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

View File

@@ -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());
}
}

View File

@@ -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

View File

@@ -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]

View File

@@ -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

View File

@@ -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";

View File

@@ -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

View File

@@ -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::<toml::Table>()
@@ -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,
}
}
}

View File

@@ -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

View File

@@ -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()
}

View File

@@ -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

View File

@@ -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]

View File

@@ -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

View File

@@ -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]

View File

@@ -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

View File

@@ -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<PluginItem> {
pub fn actions_for_service(
unit_name: &str,
display_name: &str,
is_active: bool,
) -> Vec<PluginItem> {
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:"));

View File

@@ -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

View File

@@ -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::<toml::Table>()
@@ -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::<f64>(),
parts[1].trim().parse::<f64>(),
) {
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);

View File

@@ -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

View File

@@ -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")