From dc5ab759f272f075950107ecf19b7677ffa02dd5 Mon Sep 17 00:00:00 2001 From: Javier Feliz Date: Thu, 11 Sep 2025 20:41:15 -0400 Subject: [PATCH] Icon installation in dev at least --- Makefile | 9 ++++++++- waycast-plugins/src/projects/mod.rs | 17 +++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index bba15a1..186dfdc 100644 --- a/Makefile +++ b/Makefile @@ -167,4 +167,11 @@ devicon-theme: devicon get bash -o $(DEVICON_DIR) devicon get ansible -o $(DEVICON_DIR) cp $(DEVICON_DIR)/nixos.svg $(DEVICON_DIR)/nix.svg - cp $(DEVICON_DIR)/bash.svg $(DEVICON_DIR)/shell.svg \ No newline at end of file + cp $(DEVICON_DIR)/bash.svg $(DEVICON_DIR)/shell.svg + +install-icons: ## Install icons to XDG data directory + @XDG_DATA_HOME=$${XDG_DATA_HOME:-$$HOME/.local/share} && \ + ICON_DIR="$$XDG_DATA_HOME/waycast/icons" && \ + mkdir -p "$$ICON_DIR" && \ + cp -r ./assets/icons/* "$$ICON_DIR/" && \ + echo "Icons installed to $$ICON_DIR" \ No newline at end of file diff --git a/waycast-plugins/src/projects/mod.rs b/waycast-plugins/src/projects/mod.rs index 4e2fee2..e859521 100644 --- a/waycast-plugins/src/projects/mod.rs +++ b/waycast-plugins/src/projects/mod.rs @@ -36,8 +36,21 @@ impl LauncherListItem for ProjectEntry { description: Some(self.path.to_string_lossy().to_string()), icon: { if let Some(t) = &self.project_type { - let icon_path = PathBuf::from("./devicons"); - return icon_path.join(format!("{}.svg", t.to_lowercase())).to_string_lossy().to_string(); + // Try XDG data directory first, fall back to development path + let icon_name = format!("{}.svg", t.to_lowercase()); + + if let Some(data_dir) = waycast_config::data_dir() { + let xdg_icon_path = data_dir.join("icons").join("devicons").join(&icon_name); + if xdg_icon_path.exists() { + return xdg_icon_path.to_string_lossy().to_string(); + } + } + + // Fall back to development path + let dev_icon_path = PathBuf::from("./assets/icons/devicons").join(&icon_name); + if dev_icon_path.exists() { + return dev_icon_path.to_string_lossy().to_string(); + } } String::from("vscode")