Skip to content

Commit

Permalink
small adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdenasser committed Nov 2, 2024
1 parent 30b2567 commit 4ee6716
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ codegen-units = 1 # Compile crates one after another so the compiler ca
lto = "fat" # More aggressive link-time optimization
opt-level = 3 # Optimize for maximum performance
strip = true # Remove debug symbols
incremental = false # Disable incremental compilation
28 changes: 24 additions & 4 deletions src/lib/components/ProcessTable.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,37 @@
}
function getIconForProcess(name: string): string {
// First try with com.company.something pattern
if (name.startsWith("com.")) {
const companyName = name.replace(/^com\.([^.]+)\..*$/, "$1");
const formattedCompanyName =
companyName.charAt(0).toUpperCase() + companyName.slice(1);
const companyIconKey = `si${formattedCompanyName}`;
const companyIcon =
SimpleIcons[companyIconKey as keyof typeof SimpleIcons];
if (companyIcon) {
// Use theme color instead of brand color
const color = getComputedStyle(document.documentElement)
.getPropertyValue("--text")
.trim();
const svg =
typeof companyIcon === "object" && "svg" in companyIcon
? companyIcon.svg
: "";
const svgWithColor = svg.replace("<svg", `<svg fill="${color}"`);
return `data:image/svg+xml;base64,${btoa(svgWithColor)}`;
}
}
// If no company icon found, fall back to original implementation
const cleanName = name
// Remove common app suffixes
.replace(/\.(app|exe)$/i, "")
// Replace separators with spaces
.replace(/[-_./\\]/g, " ")
// Get first word, trim, and lowercase
.split(" ")[0]
.trim()
.toLowerCase();
// Convert to SimpleIcons format (capitalize first word)
const formattedName =
cleanName.charAt(0).toUpperCase() + cleanName.slice(1);
const iconKey = `si${formattedName}`;
Expand Down

0 comments on commit 4ee6716

Please sign in to comment.