From ba0f4d27ab137f98835c98ff769d7fae70a70d95 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Tue, 13 Jul 2021 06:59:27 +0200 Subject: [PATCH] Also consider /usr/local/share/applications/ in desktop file search --- src/util.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/util.rs b/src/util.rs index 34d3c65..003ca72 100644 --- a/src/util.rs +++ b/src/util.rs @@ -46,14 +46,18 @@ pub fn get_swayr_socket_path() -> String { fn desktop_entry_folders() -> Vec> { let mut dirs: Vec> = vec![]; + + // XDG_DATA_HOME/applications if let Some(dd) = directories::BaseDirs::new() { dirs.push(dd.data_local_dir().to_path_buf().into_boxed_path()); } - dirs.push( - p::Path::new("/usr/share/applications/") - .to_path_buf() - .into_boxed_path(), - ); + + let default_dirs = + ["/usr/local/share/applications/", "/usr/share/applications/"]; + for dir in default_dirs { + dirs.push(p::Path::new(dir).to_path_buf().into_boxed_path()); + } + if let Ok(xdg_data_dirs) = std::env::var("XDG_DATA_DIRS") { for mut dir in std::env::split_paths(&xdg_data_dirs) { dir.push("applications/");