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: timeline too slow

Louis Beaumont92bf45b4a1fd
diff --git a/screenpipe-app-tauri/app/timeline/page.tsx b/screenpipe-app-tauri/app/timeline/page.tsx
index 3b3988d03..f2d5d7f44 100644
--- a/screenpipe-app-tauri/app/timeline/page.tsx
+++ b/screenpipe-app-tauri/app/timeline/page.tsx
@@ -4,7 +4,7 @@ import { useSettings } from "@/lib/hooks/use-settings";
import { Loader2, RotateCcw, AlertCircle } from "lucide-react";
import posthog from "posthog-js";
import { TimelineBlocks } from "@/components/timeline/timeline-block";
-import { TimelineIconsSection } from "@/components/timeline/timeline-dock";
+import { TimelineIconsSection } from "@/components/timeline/timeline-dock-section";
import { AudioTranscript } from "@/components/timeline/audio-transcript";
import { AIPanel } from "@/components/timeline/ai-panel";
import { TimelineProvider } from "@/lib/hooks/use-timeline-selection";
@@ -219,25 +219,21 @@ export default function Timeline() {
);
const timePercentage = useMemo(() => {
- if (
- !currentFrame ||
- !loadedTimeRange ||
- !frames.length ||
- currentIndex >= frames.length
- )
+ if (!frames.length || currentIndex >= frames.length || !loadedTimeRange) {
return 0;
+ }
- const frameTime = new Date(
- currentFrame.metadata.timestamp || frames[currentIndex].timestamp
- );
+ const currentFrame = frames[currentIndex];
+ if (!currentFrame?.timestamp) {
+ return 0;
+ }
- const totalVisibleMilliseconds =
- loadedTimeRange.end.getTime() - loadedTimeRange.start.getTime();
- const currentMilliseconds =
- frameTime.getTime() - loadedTimeRange.start.getTime();
+ const frameTime = new Date(currentFrame.timestamp);
+ const totalVisibleMilliseconds = loadedTimeRange.end.getTime() - loadedTimeRange.start.getTime();
+ const currentMilliseconds = frameTime.getTime() - loadedTimeRange.start.getTime();
return (currentMilliseconds / totalVisibleMilliseconds) * 100;
- }, [currentFrame, loadedTimeRange, currentIndex, frames]);
+ }, [currentIndex, frames, loadedTimeRange]);
useEffect(() => {
const preventScroll = (e: WheelEvent) => {
@@ -333,18 +329,19 @@ export default function Timeline() {
<div className="w-4/5 mx-auto my-8 relative select-none">
<div className="h-[60px] bg-card border rounded-lg shadow-sm cursor-crosshair relative">
- <div className="relative h-full bg-muted rounded-md overflow-hidden">
+ {/* <div className="relative h-full bg-muted rounded-md overflow-hidden">
{loadedTimeRange && (
<TimelineBlocks frames={frames} timeRange={loadedTimeRange!} />
)}
- </div>
+ </div> */}
<div
className="absolute top-0 h-full w-1 bg-foreground/50 shadow-sm opacity-80 z-10"
style={{ left: `${timePercentage}%` }}
>
<div className="relative -top-6 right-3 text-[10px] text-muted-foreground whitespace-nowrap">
- {frames[currentIndex] &&
+ {currentIndex < frames.length &&
+ frames[currentIndex] &&
frames[currentIndex].timestamp &&
(() => {
try {
diff --git a/screenpipe-app-tauri/components/timeline/ai-panel.tsx b/screenpipe-app-tauri/components/timeline/ai-panel.tsx
index 1c0ddce3c..3b56c6a93 100644
--- a/screenpipe-app-tauri/components/timeline/ai-panel.tsx
+++ b/screenpipe-app-tauri/components/timeline/ai-panel.tsx
@@ -63,7 +63,7 @@ export function AIPanel({
const aiPanelRef = useRef<HTMLDivElement>(null);
const resizerRef = useRef<HTMLDivElement | null>(null);
const { toast } = useToast();
- const { selectionRange } = useTimelineSelection();
+ const { selectionRange, setSelectionRange } = useTimelineSelection();
useEffect(() => {
setOsType(platform());
@@ -226,6 +226,7 @@ export function AIPanel({
setChatMessages([]);
setAiInput("");
onClose();
+ setSelectionRange(null);
};
if (!selectionRange) return null;
diff --git a/screenpipe-app-tauri/components/timeline/timeline-block.tsx b/screenpipe-app-tauri/components/timeline/timeline-block.tsx
index df6864ad3..0931ccd96 100644
--- a/screenpipe-app-tauri/components/timeline/timeline-block.tsx
+++ b/screenpipe-app-tauri/components/timeline/timeline-block.tsx
@@ -49,167 +49,6 @@ export function TimelineBlocks({ frames, timeRange }: TimelineBlocksProps) {
const getAppColor = useColorGenerator();
const { setSelectionRange } = useTimelineSelection();
- // Memoize the sorted frames
- const sortedFrames = useMemo(
- // TODO: this should not be necessary
- () =>
- [...frames].sort(
- (a, b) =>
- new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime()
- ),
- [frames]
- );
-
- // Memoize the block generation with precise dependencies
- const blocks = useMemo(() => {
- if (frames.length === 0) return [];
-
- const visibleBlocks: (TimeBlock & { isGap?: boolean })[] = [];
- let currentBlock: TimeBlock | null = null;
- let lastEndTime: Date | null = null;
-
- for (const frame of sortedFrames) {
- const timestamp = new Date(frame.timestamp);
- if (!frame.devices?.[0]?.metadata?.app_name) continue;
-
- const appName = frame.devices[0].metadata.app_name;
- const windowName = frame.devices[0].metadata.window_name;
-
- if (timestamp < timeRange.start || timestamp > timeRange.end) continue;
-
- // Handle gap detection
- if (lastEndTime && timestamp.getTime() - lastEndTime.getTime() > 1000) {
- visibleBlocks.push({
- appName: "gap",
- windowName: "No Activity",
- startTime: lastEndTime,
- endTime: timestamp,
- color: "transparent",
- isGap: true,
- });
- }
-
- // Handle block creation/update
- if (!currentBlock) {
- currentBlock = {
- appName,
- windowName,
- startTime: timestamp,
- endTime: timestamp,
- color: getAppColor(appName),
- };
- } else if (currentBlock.appName !== appName) {
- visibleBlocks.push(currentBlock);
- currentBlock = {
- appName,
- windowName,
- startTime: timestamp,
- endTime: timestamp,
- color: getAppColor(appName),
- };
- } else {
- currentBlock.endTime = timestamp;
- }
-
- lastEndTime = timestamp;
- }
-
- if (currentBlock) visibleBlocks.push(currentBlock);
-
- // Handle edge gaps
- if (visibleBlocks[0]?.startTime.getTime() > timeRange.start.getTime()) {
- visibleBlocks.unshift({
- appName: "gap",
- windowName: "No Activity",
- startTime: timeRange.start,
- endTime: visibleBlocks[0].startTime,
- color: "transparent",
- isGap: true,
- });
- }
-
- const lastBlock = visibleBlocks[visibleBlocks.length - 1];
- if (lastBlock && lastBlock.endTime.getTime() < timeRange.end.getTime()) {
- visibleBlocks.push({
- appName: "gap",
- windowName: "No Activity",
- startTime: lastBlock.endTime,
- endTime: timeRange.end,
- color: "transparent",
- isGap: true,
- });
- }
-
- return visibleBlocks;
- }, [
- sortedFrames, // Use sorted frames instead of raw frames
- timeRange.start, // Use timestamp instead of Date object
- timeRange.end,
- getAppColor,
- ]);
-
- // Add selection state
- const [isDragging, setIsDragging] = useState(false);
- const [selectionStart, setSelectionStart] = useState<number | null>(null);
- const [selectionEnd, setSelectionEnd] = useState<number | null>(null);
- const containerRef = useRef<HTMLDivElement>(null);
-
- // Add mouse handlers
- const handleMouseDown = (e: React.MouseEvent) => {
- const element = document.elementFromPoint(e.clientX, e.clientY);
- const blockIndex = element?.getAttribute("data-block-index");
- if (blockIndex) {
- const index = parseInt(blockIndex);
- setSelectionStart(index);
- setSelectionEnd(index);
- setSelectionRange({
- start: blocks[index].startTime,
- end: blocks[index].endTime,
- });
- setIsDragging(true);
- }
- };
-
- // Add debouncing to mouse move handler
- const handleMouseMove = useMemo(
- () =>
- debounce((e: React.MouseEvent) => {
- if (!isDragging || selectionStart === null) return;
- const element = document.elementFromPoint(e.clientX, e.clientY);
- const blockIndex = element?.getAttribute("data-block-index");
- if (blockIndex) {
- setSelectionEnd(parseInt(blockIndex));
- setSelectionRange({
- start: blocks[selectionStart].startTime,
- end: blocks[parseInt(blockIndex)].endTime,
- });
- }
- }, 16), // ~60fps
- [isDragging, selectionStart]
- );
-
- const handleMouseUp = () => {
- setIsDragging(false);
- };
-
- // Calculate selection bounds only when needed
- const selectionBounds = useMemo(() => {
- if (selectionStart === null || selectionEnd === null) return null;
-
- const start = Math.min(selectionStart, selectionEnd);
- const end = Math.max(selectionStart, selectionEnd);
-
- return {
- left:
- ((blocks[start].startTime.getTime() - timeRange.start.getTime()) /
- (timeRange.end.getTime() - timeRange.start.getTime())) *
- 100,
- width:
- ((blocks[end].endTime.getTime() - blocks[start].startTime.getTime()) /
- (timeRange.end.getTime() - timeRange.start.getTime())) *
- 100,
- };
- }, [selectionStart, selectionEnd, blocks, timeRange]);
return (
<div
@@ -220,7 +59,7 @@ export function TimelineBlocks({ frames, timeRange }: TimelineBlocksProps) {
onMouseMove={handleMouseMove}
style={{ userSelect: "none" }}
>
- {/* Regular blocks */}
+ {/* Only render actual activity blocks */}
{blocks.map((block, index) => {
const blockStart =
((block.startTime.getTime() - timeRange.start.getTime()) /
@@ -231,15 +70,15 @@ export function TimelineBlocks({ frames, timeRange }: TimelineBlocksProps) {
(timeRange.end.getTime() - timeRange.start.getTime())) *
100;
+ const tooltipText = `${block.appName}\n${
+ block.windowName
+ }\n${formatTime(block.startTime)} - ${formatTime(block.endTime)}`;
+
return (
<div
key={`${block.appName}-${index}`}
data-block-index={index}
- className={`absolute top-0 bottom-0 transition-opacity z-10 ${
- block.isGap
- ? "hover:bg-gray-200 dark:hover:bg-gray-700 opacity-0 hover:opacity-30"
- : "opacity-50 hover:opacity-80"
- }`}
+ className="absolute top-0 bottom-0 transition-opacity z-10 opacity-50 hover:opacity-80"
style={{
transform: `translateX(${blockStart}%) scaleX(${
blockWidth / 100
@@ -248,9 +87,7 @@ export function TimelineBlocks({ frames, timeRange }: TimelineBlocksProps) {
width: "100%",
backgroundColor: block.color,
}}
- title={`${block.appName}\n${
- block.windowName
- }\n${block.startTime.toLocaleTimeString()} - ${block.endTime.toLocaleTimeString()}`}
+ title={tooltipText}
/>
);
})}
diff --git a/screenpipe-app-tauri/components/timeline/timeline-dock-section.tsx b/screenpipe-app-tauri/components/timeline/timeline-dock-section.tsx
new file mode 100644
index 000000000..4b00da828
--- /dev/null
+++ b/screenpipe-app-tauri/components/timeline/timeline-dock-section.tsx
@@ -0,0 +1,195 @@
+import React, { useEffect, useState, useCallback, useMemo } from "react";
+import { platform } from "@tauri-apps/plugin-os";
+import { invoke } from "@tauri-apps/api/core";
+import { StreamTimeSeriesResponse } from "@/app/timeline/page";
+import { stringToColor } from "@/lib/utils";
+
+interface ProcessedBlock {
+ appName: string;
+ percentThroughDay: number;
+ timestamp: Date;
+ iconSrc?: string;
+}
+
+export function TimelineIconsSection({
+ blocks,
+}: {
+ blocks: StreamTimeSeriesResponse[];
+}) {
+ const [iconCache, setIconCache] = useState<{ [key: string]: string }>({});
+
+ // Get the visible time range
+ const timeRange = useMemo(() => {
+ if (blocks.length === 0) return null;
+ const startTime = new Date(blocks[blocks.length - 1].timestamp);
+ const endTime = new Date(blocks[0].timestamp);
+ return { start: startTime, end: endTime };
+ }, [blocks]);
+
+ // Memoize processed blocks with position calculations
+ const processedBlocks = useMemo<ProcessedBlock[]>(() => {
+ if (!timeRange) return [];
+
+ // Group frames by app name first
+ const appGroups: { [key: string]: Date[] } = {};
+
+ blocks.forEach((frame) => {
+ // Remove any filtering on devices/metadata to show more apps
+ frame.devices.forEach((device) => {
+ if (!device.metadata?.app_name) return;
+
+ const timestamp = new Date(frame.timestamp);
+ const appName = device.metadata.app_name;
+
+ if (timestamp < timeRange.start || timestamp > timeRange.end) return;
+
+ if (!appGroups[appName]) {
+ appGroups[appName] = [];
+ }
+ appGroups[appName].push(timestamp);
+ });
+ });
+
+ const b: ProcessedBlock[] = [];
+
+ Object.entries(appGroups).forEach(([appName, timestamps]) => {
+ timestamps.sort((a, b) => a.getTime() - b.getTime());
+
+ // Reduce gap threshold to 5 seconds to create more blocks
+ const GAP_THRESHOLD = 5000; // 5 seconds in milliseconds
+ let blockStart = timestamps[0];
+ let lastTimestamp = timestamps[0];
+
+ timestamps.forEach((timestamp) => {
+ if (timestamp.getTime() - lastTimestamp.getTime() > GAP_THRESHOLD) {
+ b.push({
+ appName,
+ timestamp: new Date(
+ blockStart.getTime() +
+ (lastTimestamp.getTime() - blockStart.getTime()) / 2
+ ),
+ percentThroughDay:
+ ((blockStart.getTime() +
+ (lastTimestamp.getTime() - blockStart.getTime()) / 2 -
+ timeRange.start.getTime()) /
+ (timeRange.end.getTime() - timeRange.start.getTime())) *
+ 100,
+ iconSrc: iconCache[appName],
+ });
+ blockStart = timestamp;
+ }
+ lastTimestamp = timestamp;
+ });
+
+ b.push({
+ appName,
+ timestamp: new Date(
+ blockStart.getTime() +
+ (lastTimestamp.getTime() - blockStart.getTime()) / 2
+ ),
+ percentThroughDay:
+ ((blockStart.getTime() +
+ (lastTimestamp.getTime() - blockStart.getTime()) / 2 -
+ timeRange.start.getTime()) /
+ (timeRange.end.getTime() - timeRange.start.getTime())) *
+ 100,
+ iconSrc: iconCache[appName],
+ });
+ });
+
+ // Reduce minimum spacing between blocks to 0.5%
+ return b
+ .sort((a, b) => a.percentThroughDay - b.percentThroughDay)
+ .filter((block, index, array) => {
+ if (index === 0) return true;
+ const prevBlock = array[index - 1];
+ return (
+ Math.abs(block.percentThroughDay - prevBlock.percentThroughDay) > 0.5
+ );
+ });
+ }, [blocks, iconCache, timeRange]);
+
+ const loadAppIcon = useCallback(
+ async (appName: string, appPath?: string) => {
+ try {
+ // Check platform first to avoid unnecessary invokes
+ const p = platform();
+ if (p !== "macos") return; // Early return for unsupported platforms
+
+ if (iconCache[appName]) return;
+
+ const icon = await invoke<{ base64: string; path: string } | null>(
+ "get_app_icon",
+ { appName, appPath }
+ );
+
+ if (icon?.base64) {
+ // Add null check for base64
+ setIconCache((prev) => ({
+ ...prev,
+ [appName]: icon.base64,
+ }));
+ }
+ } catch (error) {
+ console.error(`failed to load icon for ${appName}:`, error);
+ // Fail silently - the UI will just not show an icon
+ }
+ },
+ [iconCache]
+ );
+
+ useEffect(() => {
+ const loadIcons = async () => {
+ const p = platform();
+ if (p !== "macos") return;
+
+ // Load icons for unique app names only
+ processedBlocks.forEach((block) => {
+ loadAppIcon(block.appName);
+ });
+ };
+
+ loadIcons();
+ }, [processedBlocks, loadAppIcon]);
+
+ return (
+ <div className="absolute -top-8 inset-x-0 pointer-events-none h-8">
+ {processedBlocks.map((block, i) => {
+ const bgColor = stringToColor(block.appName);
+ return (
+ <div
+ key={`${block.appName}-${i}`}
+ className="absolute top-0 h-full w-full"
+ style={{
+ left: `${block.percentThroughDay}%`,
+ transform: "translateX(-50%)",
+ }}
+ >
+ {block.iconSrc ? (
+ <div
+ className="w-5 h-5 absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full"
+ style={{
+ backgroundColor: `${bgColor}40`, // 40 is for 25% opacity
+ padding: "2px",
+ }}
+ >
+ <img
+ src={`data:image/png;base64,${block.iconSrc}`}
+ className="w-full h-full opacity-70"
+ alt={block.appName}
+ loading="lazy"
+ decoding="async"
+ />
+ </div>
+ ) : (
+ <div
+ className="w-5 h-5 absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full"
+ style={{ backgroundColor: bgColor }}
+ />
+ )}
+ </div>
+ );
+ })}
+ </div>
+ );
+}
diff --git a/screenpipe-app-tauri/components/timeline/timeline-dock.tsx b/screenpipe-app-tauri/components/timeline/timeline-dock.tsx
index bb9e811ea..d5f171ada 100644
--- a/screenpipe-app-tauri/components/timeline/timeline-dock.tsx
+++ b/screenpipe-app-tauri/components/timeline/timeline-dock.tsx
@@ -1,10 +1,7 @@
-import React, { useEffect, useState, useCallback, useMemo } from "react";
+import React, { useMemo } from "react";
import { motion, AnimatePresence } from "framer-motion";
import { cn } from "@/lib/utils";
-import { platform } from "@tauri-apps/plugin-os";
-import { invoke } from "@tauri-apps/api/core";
import { debounce } from "lodash";
-import { StreamTimeSeriesResponse } from "@/app/timeline/page";
interface TimelineDockProps {
children: React.ReactNode;
@@ -101,15 +98,15 @@ export const TimelineDockIcon = React.memo(function TimelineDockIcon({
// Calculate distance as percentage difference
const distanceFromMouse = Math.abs(mousePosition - iconPosition);
- if (distanceFromMouse < 5) {
- // Reduced distance threshold to 5%
+ if (distanceFromMouse < 15) {
+ // Increased distance threshold to 15%
scale = Math.max(
1,
- magnification - (distanceFromMouse / 5) * magnification
+ magnification - (distanceFromMouse / 15) * (magnification - 1)
);
- spacing = scale > 1 ? 2 * (1 - distanceFromMouse / 5) : 0;
- isClosest = distanceFromMouse < 2; // Show tooltip when within 2%
+ spacing = scale > 1 ? 4 * (1 - distanceFromMouse / 15) : 0;
+ isClosest = distanceFromMouse < 5; // Increased tooltip threshold to 5%
}
}
@@ -157,190 +154,3 @@ export const TimelineDockIcon = React.memo(function TimelineDockIcon({
</motion.div>
);
});
-
-interface ProcessedBlock {
- appName: string;
- percentThroughDay: number;
- timestamp: Date;
- iconSrc?: string;
-}
-
-export function TimelineIconsSection({
- blocks,
-}: {
- blocks: StreamTimeSeriesResponse[];
-}) {
- const [iconCache, setIconCache] = useState<{ [key: string]: string }>({});
-
- // Memoize significant blocks calculation
- const significantBlocks = useMemo(
- () =>
- blocks.filter((block) => {
- return block.devices.every((device) => device.metadata.app_name);
- }),
- [blocks]
- );
-
- // Get the visible time range
- const timeRange = useMemo(() => {
- if (blocks.length === 0) return null;
- const startTime = new Date(blocks[blocks.length - 1].timestamp);
- const endTime = new Date(blocks[0].timestamp);
- return { start: startTime, end: endTime };
- }, [blocks]);
-
- // Memoize processed blocks with position calculations
- const processedBlocks = useMemo<ProcessedBlock[]>(() => {
- if (!timeRange) return [];
-
- // Use the same block calculation logic as timeline-block.tsx
- const blocks: {
- appName: string;
- startTime: Date;
- endTime: Date;
- }[] = [];
-
- let currentBlock: {
- appName: string;
- startTime: Date;
- endTime: Date;
- } | null = null;
-
- // Sort frames by timestamp first
- const sortedFrames = [...significantBlocks].sort(
- (a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime()
- );
-
- sortedFrames.forEach((frame) => {
- const timestamp = new Date(frame.timestamp);
- // Ensure we have devices data
- if (!frame.devices?.[0]?.metadata?.app_name) return;
-
- const appName = frame.devices[0].metadata.app_name;
- if (timestamp < timeRange.start || timestamp > timeRange.end) return;
-
- if (!currentBlock) {
- currentBlock = {
- appName,
- startTime: timestamp,
- endTime: timestamp,
- };
- } else if (currentBlock.appName !== appName) {
- blocks.push(currentBlock);
- currentBlock = {
- appName,
- startTime: timestamp,
- endTime: timestamp,
- };
- } else {
- currentBlock.endTime = timestamp;
- }
- });
-
- if (currentBlock) blocks.push(currentBlock);
-
- // console.log("Initial blocks:", blocks);
-
- // Convert blocks to icons
- // Only show icons for blocks that are longer than 5% of total time
- const totalRange = timeRange.end.getTime() - timeRange.start.getTime();
- const minDuration = totalRange * 0.05;
-
- return blocks
- .filter(block => {
- const duration = block.endTime.getTime() - block.startTime.getTime();
- return duration > minDuration;
- })
- .map(block => {
- // Place icon at the middle of the block
- const middleTime = new Date(
- block.startTime.getTime() +
- (block.endTime.getTime() - block.startTime.getTime()) / 2
- );
-
- const percentPosition =
- ((middleTime.getTime() - timeRange.start.getTime()) / totalRange) * 100;
-
- return {
- appName: block.appName,
- percentThroughDay: percentPosition,
- timestamp: middleTime,
- iconSrc: iconCache[block.appName],
- };
- })
- .filter((block, index, array) => {
- if (index === 0) return true;
- const prevBlock = array[index - 1];
- // Ensure icons don't overlap
- return Math.abs(block.percentThroughDay - prevBlock.percentThroughDay) > 3;
- });
- }, [significantBlocks, iconCache, timeRange]);
-
- const loadAppIcon = useCallback(
- async (appName: string, appPath?: string) => {
- try {
- // Check platform first to avoid unnecessary invokes
- const p = platform();
- if (p !== "macos") return; // Early return for unsupported platforms
-
- if (iconCache[appName]) return;
-
- const icon = await invoke<{ base64: string; path: string } | null>(
- "get_app_icon",
- { appName, appPath }
- );
-
- if (icon?.base64) {
- // Add null check for base64
- setIconCache((prev) => ({
- ...prev,
- [appName]: icon.base64,
- }));
- }
- } catch (error) {
- console.error(`failed to load icon for ${appName}:`, error);
- // Fail silently - the UI will just not show an icon
- }
- },
- [iconCache]
- );
-
- useEffect(() => {
- const loadIcons = async () => {
- const p = platform();
- if (p !== "macos") return;
-
- // Load icons for unique app names only
- processedBlocks.forEach((block) => {
- loadAppIcon(block.appName);
- });
- };
-
- loadIcons();
- }, [processedBlocks, loadAppIcon]);
-
- return (
- <div className="absolute -top-8 inset-x-0 pointer-events-none h-8">
- {processedBlocks.map((block, i) => (
- <div
- key={`${block.appName}-${i}`}
- className="absolute top-0 h-full w-full"
- style={{
- left: `${block.percentThroughDay}%`,
- transform: "translateX(-50%)",
- }}
- >
- {block.iconSrc && (
- <img
- src={`data:image/png;base64,${block.iconSrc}`}
- className="w-5 h-5 absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 opacity-70"
- alt={block.appName}
- loading="lazy"
- decoding="async"
- />
- )}
- </div>
- ))}
- </div>
- );
-}
diff --git a/screenpipe-app-tauri/lib/utils.ts b/screenpipe-app-tauri/lib/utils.ts
index 9a5d395b2..c9a17efa1 100644
--- a/screenpipe-app-tauri/lib/utils.ts
+++ b/screenpipe-app-tauri/lib/utils.ts
@@ -126,3 +126,16 @@ export function parseKeyboardShortcut(shortcut: string): string {
}
return "";
}
+
+export function stringToColor(str: string): string {
+ let hash = 0;
+ for (let i = 0; i < str.length; i++) {
+ hash = str.charCodeAt(i) + ((hash << 5) - hash);
+ }
+ let color = "#";
+ for (let i = 0; i < 3; i++) {
+ const value = (hash >> (i * 8)) & 0xff;
+ color += ("00" + value.toString(16)).substr(-2);
+ }
+ return color;
+}
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index ff40b0e59..d8b3ab046 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -3777,7 +3777,7 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "screenpipe-app"
-version = "0.9.9"
+version = "0.9.18"
dependencies = [
"anyhow",
"axum",