Got icons working baybeee

This commit is contained in:
Javier Feliz 2025-09-11 20:12:41 -04:00
parent 919e6a44f6
commit 76bb34391e
3 changed files with 19 additions and 3 deletions

View File

@ -157,3 +157,13 @@ docs: ## Build and open documentation
tools: ## Install useful development tools
cargo install cargo-watch cargo-audit cargo-machete cargo-flamegraph cargo-deb cargo-outdated
@echo "Development tools installed!"
devicon-theme:
rm -rf ./devicons
mkdir -p ./devicons
devicon remix -t framework,language -o ./devicons --variant original --fallback plain
devicon get nixos -o ./devicons
devicon get bash -o ./devicons
devicon get ansible -o ./devicons
cp devicons/nixos.svg devicons/nix.svg
cp devicons/bash.svg devicons/shell.svg

View File

@ -468,7 +468,6 @@ fn find_icon_file(
size: &str,
icon_theme: &IconTheme,
) -> Option<std::path::PathBuf> {
println!("Icon: {}", icon_name);
let cache_key = format!("icon:{}:{}", icon_name, size);
let cache = waycast_core::cache::get();
@ -488,6 +487,11 @@ fn search_for_icon(
size: &str,
icon_theme: &IconTheme,
) -> Option<std::path::PathBuf> {
// Before doing everything below, check if it's a path
if Path::new(icon_name).exists() {
return Some(PathBuf::from(icon_name));
}
let pixmap_paths: Vec<PathBuf> = icon_theme
.search_path()
.into_iter()

View File

@ -229,7 +229,9 @@ fn detect_project_type(path: &str) -> Option<String> {
} else {
let langs = TOKEI_SCANNER.scan(path, Some(1));
if let Some(l) = langs.first() {
return Some(l.name.to_owned());
// We do some special replacements so it's easier to match
// with the icon file names
return Some(l.name.to_owned().replace("+", "plus").replace("#", "sharp"));
}
}