overhaul desktop finder

This commit is contained in:
galister
2025-12-28 22:11:23 +09:00
parent 2ff83b63f2
commit 686a6f3ba5
8 changed files with 203 additions and 167 deletions

View File

@@ -28,7 +28,6 @@ wlx-common = { path = "../wlx-common" }
anyhow.workspace = true
clap.workspace = true
freedesktop.workspace = true
glam = { workspace = true, features = ["mint", "serde"] }
idmap = { workspace = true, features = ["serde"] }
idmap-derive. workspace = true
@@ -40,6 +39,7 @@ serde = { workspace = true, features = ["rc"] }
serde_json.workspace = true
vulkano.workspace = true
vulkano-shaders.workspace = true
xdg.workspace = true
ash = "^0.38.0" # must match vulkano
bytes = { version = "1.11.0" }

View File

@@ -1,4 +1,3 @@
use freedesktop::xdg_config_home;
use log::error;
use std::{path::PathBuf, sync::LazyLock};
@@ -11,10 +10,13 @@ pub enum ConfigRoot {
const FALLBACK_CONFIG_PATH: &str = "/tmp/wlxoverlay";
static CONFIG_ROOT_PATH: LazyLock<PathBuf> = LazyLock::new(|| {
// Panics if $XDG_CONFIG_HOME and $HOME are both unset.
let mut dir = xdg_config_home();
dir.push("wlxoverlay");
return dir;
if let Some(mut dir) = xdg::BaseDirectories::new().get_config_home() {
dir.push("wlxoverlay");
return dir;
}
//Return fallback config path
error!("Err: Failed to find config path, using {FALLBACK_CONFIG_PATH}");
PathBuf::from(FALLBACK_CONFIG_PATH)
});
pub fn get_config_root() -> PathBuf {