Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: app icon fallback — use stateful OptionIcon component

Louis Beaumont9932ee6b49c0
diff --git a/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx b/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx
index fa93afc76..e32e37256 100644
--- a/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx
@@ -119,20 +119,21 @@ const createWindowOptions = (
value: item.name,
label: item.name,
icon: AppWindowMac,
- iconUrl: item.app_name ? getAppIconUrl(item.app_name) : undefined,
+ iconUrl: getAppIconUrl(item.app_name || item.name),
description: [
item.app_name && item.app_name !== item.name ? item.app_name : null,
`${formatCount(item.count)} captures`,
].filter(Boolean).join(" · "),
}));
- // Custom patterns don't have real app names — skip iconUrl so the Lucide fallback shows
+ // Custom patterns try the app-icon endpoint; OptionIcon falls back to Lucide if it returns a placeholder
const customOptions = existingPatterns
.filter((pattern) => !windowItems.some((item) => item.name === pattern))
.map((pattern) => ({
value: pattern,
label: pattern,
icon: AppWindowMac,
+ iconUrl: getAppIconUrl(pattern),
}));
return [...windowOptions, ...customOptions];
@@ -1540,30 +1541,39 @@ Your screen is a pipe. Everything you see, hear, and type flows through it. Scre
<h2 className="text-xs font-semibold text-muted-foreground uppercase tracking-wider px-1">Filtering</h2>
{/* All | Personal | Shared with team tabs */}
- {team.team && (
- <div className="flex items-center gap-4 border-b border-border">
- {(["all", "personal", "team"] as const).map((tab) => {
- const personalCount = settings.ignoredWindows.length + settings.includedWindows.length + (settings.ignoredUrls || []).length;
- const teamCount = (settings.teamFilters?.ignoredWindows?.length ?? 0) + (settings.teamFilters?.includedWindows?.length ?? 0) + (settings.teamFilters?.ignoredUrls?.length ?? 0);
- const count = tab === "all" ? personalCount + teamCount : tab === "personal" ? personalCount : teamCount;
- const label = tab === "all" ? "All" : tab === "personal" ? "Personal" : "Shared with team";
- return (
- <button
- key={tab}
- onClick={() => setFilterView(tab)}
- className={cn(
- "pb-2 text-sm transition-colors duration-150 border-b-2 -mb-px",
- filterView === tab
- ? "border-foreground text-foreground font-medium"
- : "border-transparent text-muted-foreground hover:text-foreground"
- )}
- >
- {label} ({count})
- </button>
- );
- })}
- </div>
- )}
+ {team.team && (() => {
+ const teamIgnored = new Set(settings.teamFilters?.ignoredWindows ?? []);
+ const teamIncluded = new Set(settings.teamFilters?.includedWindows ?? []);
+ const teamUrls = new Set(settings.teamFilters?.ignoredUrls ?? []);
+ const personalOnlyCount =
+ settings.ignoredWindows.filter((w) => !teamIgnored.has(w)).length +
+ settings.includedWindows.filter((w) => !teamIncluded.has(w)).length +
+ (settings.ignoredUrls || []).filter((u) => !teamUrls.has(u)).length;
+ const teamOnlyCount = teamIgnored.size + teamIncluded.size + teamUrls.size;
+ const allCount = personalOnlyCount + teamOnlyCount;
+ return (
+ <div className="flex items-center gap-4 border-b border-border">
+ {(["all", "personal", "team"] as const).map((tab) => {
+ const count = tab === "all" ? allCount : tab === "personal" ? personalOnlyCount : teamOnlyCount;
+ const label = tab === "all" ? "All" : tab === "personal" ? "Personal" : "Shared with team";
+ return (
+ <button
+ key={tab}
+ onClick={() => setFilterView(tab)}
+ className={cn(
+ "pb-2 text-sm transition-colors duration-150 border-b-2 -mb-px",
+ filterView === tab
+ ? "border-foreground text-foreground font-medium"
+ : "border-transparent text-muted-foreground hover:text-foreground"
+ )}
+ >
+ {label} ({count})
+ </button>
+ );
+ })}
+ </div>
+ );
+ })()}
{/* Personal filters (shown in "all" and "personal" views) */}
{filterView !== "team" && (
diff --git a/apps/screenpipe-app-tauri/components/ui/multi-select.tsx b/apps/screenpipe-app-tauri/components/ui/multi-select.tsx
index e4a9a6b9d..67328b65b 100644
--- a/apps/screenpipe-app-tauri/components/ui/multi-select.tsx
+++ b/apps/screenpipe-app-tauri/components/ui/multi-select.tsx
@@ -31,6 +31,37 @@ import {
CommandSeparator,
} from "@/components/ui/command";
+function OptionIcon({
+ iconUrl,
+ icon: Icon,
+ className,
+}: {
+ iconUrl?: string;
+ icon?: React.ComponentType<{ className?: string }>;
+ className?: string;
+}) {
+ const [imgFailed, setImgFailed] = React.useState(false);
+
+ if (iconUrl && !imgFailed) {
+ return (
+ <img
+ src={iconUrl}
+ alt=""
+ className={cn("rounded-sm object-contain", className)}
+ onLoad={(e) => {
+ const img = e.target as HTMLImageElement;
+ if (img.naturalWidth <= 2) setImgFailed(true);
+ }}
+ onError={() => setImgFailed(true)}
+ />
+ );
+ }
+ if (Icon) {
+ return <Icon className={cn("text-muted-foreground", className)} />;
+ }
+ return null;
+}
+
/**
* Variants for the multi-select component to handle different styles.
* Uses class-variance-authority (cva) to define different styles based on "variant" prop.
@@ -288,17 +319,11 @@ export const MultiSelect = React.forwardRef<
)}
style={{ animationDuration: `${animation}s` }}
>
- {option?.iconUrl ? (
- <img
- src={option.iconUrl}
- alt=""
- className="h-3.5 w-3.5 mr-1.5 rounded-sm"
- onLoad={(e) => { const img = e.target as HTMLImageElement; if (img.naturalWidth <= 2) img.style.display = 'none'; }}
- onError={(e) => { (e.target as HTMLImageElement).style.display = 'none'; }}
- />
- ) : IconComponent ? (
- <IconComponent className="h-4 w-4 mr-2" />
- ) : null}
+ <OptionIcon
+ iconUrl={option?.iconUrl}
+ icon={IconComponent}
+ className="h-3.5 w-3.5 mr-1.5 shrink-0"
+ />
{option?.label || value}
<XCircle
className="ml-2 h-4 w-4 cursor-pointer"
@@ -424,17 +449,11 @@ export const MultiSelect = React.forwardRef<
>
<CheckIcon className="h-4 w-4" />
</div>
- {option.iconUrl ? (
- <img
- src={option.iconUrl}
- alt=""
- className="mr-2 h-4 w-4 shrink-0 rounded-sm"
- onLoad={(e) => { const img = e.target as HTMLImageElement; if (img.naturalWidth <= 2) img.style.display = 'none'; }}
- onError={(e) => { (e.target as HTMLImageElement).style.display = 'none'; }}
- />
- ) : option.icon ? (
- <option.icon className="mr-2 h-4 w-4 text-muted-foreground shrink-0" />
- ) : null}
+ <OptionIcon
+ iconUrl={option.iconUrl}
+ icon={option.icon}
+ className="mr-2 h-4 w-4 shrink-0"
+ />
<div className="flex flex-col min-w-0 flex-1">
<span className="truncate">{option.label}</span>
{option.description && (