diff --git a/Cargo.toml b/Cargo.toml index 9b94371..6d37605 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,5 +5,5 @@ members = [ "rmenu-plugin", "plugin-run", "plugin-desktop", - "rtest", + "plugin-desktop2", ] diff --git a/plugin-desktop2/src/icons.rs b/plugin-desktop2/src/icons.rs index 50afbc9..3f7e023 100644 --- a/plugin-desktop2/src/icons.rs +++ b/plugin-desktop2/src/icons.rs @@ -131,7 +131,7 @@ impl<'a> ThemeSpec<'a> { /// Sort Theme Directories by Priority, Append Root, and Collect Names Only #[inline] -fn sort_dirs(base: &PathBuf, dirs: &mut Vec) -> Vec { +fn sort_dirs(dirs: &mut Vec) -> Vec { dirs.sort_by_key(|p| p.priority); dirs.push(PathPriority::new("".into(), 0)); dirs.into_iter().map(|p| p.path.to_owned()).collect() @@ -180,7 +180,7 @@ fn parse_index(spec: &ThemeSpec) -> Result { Ok(ThemeInfo { priority: index, name: name.to_owned(), - paths: sort_dirs(spec.root, &mut directories), + paths: sort_dirs(&mut directories), }) } @@ -218,7 +218,7 @@ fn guess_index(spec: &ThemeSpec) -> Result { Ok(ThemeInfo { name, priority: index, - paths: sort_dirs(spec.root, &mut directories), + paths: sort_dirs(&mut directories), }) } @@ -239,7 +239,7 @@ impl IconSpec { } pub fn standard(cfg: &PathBuf, sizes: Vec) -> Self { - let mut icon_paths = crate::data_dirs("icons"); + let icon_paths = crate::data_dirs("icons"); let themes = active_themes(cfg, &icon_paths); Self::new(icon_paths, themes, sizes) } diff --git a/plugin-desktop2/src/main.rs b/plugin-desktop2/src/main.rs index f03e845..57497fc 100644 --- a/plugin-desktop2/src/main.rs +++ b/plugin-desktop2/src/main.rs @@ -2,7 +2,6 @@ use std::fs::read_to_string; use std::path::PathBuf; use freedesktop_desktop_entry::{DesktopEntry, Iter}; -use freedesktop_icons::lookup; use once_cell::sync::Lazy; use regex::Regex; use rmenu_plugin::{Action, Entry, Method}; @@ -36,24 +35,6 @@ fn data_dirs(dir: &str) -> Vec { .collect() } -/// Find Freedesktop Default Theme -fn default_theme() -> String { - data_dirs("icons") - .into_iter() - .map(|p| p.join("default/index.theme")) - .filter(|p| p.exists()) - .find_map(|p| { - let content = read_to_string(&p).ok()?; - let config = DesktopEntry::decode(&p, &content).ok()?; - config - .groups - .get("Icon Theme") - .and_then(|g| g.get("Name")) - .map(|key| key.0.to_owned()) - }) - .unwrap_or_else(|| "Hicolor".to_string()) -} - /// Modify Exec Statements to Remove %u/%f/etc... #[inline(always)] fn fix_exec(exec: &str) -> String {