Icon installation in dev at least

This commit is contained in:
Javier Feliz 2025-09-11 20:41:15 -04:00
parent 4c1fa88d4a
commit dc5ab759f2
2 changed files with 23 additions and 3 deletions

View File

@ -167,4 +167,11 @@ devicon-theme:
devicon get bash -o $(DEVICON_DIR) devicon get bash -o $(DEVICON_DIR)
devicon get ansible -o $(DEVICON_DIR) devicon get ansible -o $(DEVICON_DIR)
cp $(DEVICON_DIR)/nixos.svg $(DEVICON_DIR)/nix.svg cp $(DEVICON_DIR)/nixos.svg $(DEVICON_DIR)/nix.svg
cp $(DEVICON_DIR)/bash.svg $(DEVICON_DIR)/shell.svg 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"

View File

@ -36,8 +36,21 @@ impl LauncherListItem for ProjectEntry {
description: Some(self.path.to_string_lossy().to_string()), description: Some(self.path.to_string_lossy().to_string()),
icon: { icon: {
if let Some(t) = &self.project_type { if let Some(t) = &self.project_type {
let icon_path = PathBuf::from("./devicons"); // Try XDG data directory first, fall back to development path
return icon_path.join(format!("{}.svg", t.to_lowercase())).to_string_lossy().to_string(); 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") String::from("vscode")