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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
add control center to ignore apps, colors in timeline
Louis Beaumont795e98436f09
diff --git a/screenpipe-app-tauri/app/timeline/page.tsx b/screenpipe-app-tauri/app/timeline/page.tsxindex 415b39cc4..3378dc349 100644--- a/screenpipe-app-tauri/app/timeline/page.tsx+++ b/screenpipe-app-tauri/app/timeline/page.tsx@@ -21,7 +21,7 @@ import { platform } from "@tauri-apps/plugin-os";import posthog from "posthog-js";import { TimelineBlocks } from "@/components/timeline/timeline-block";-interface StreamTimeSeriesResponse {+export interface StreamTimeSeriesResponse {timestamp: string;devices: DeviceFrameResponse[];}@@ -142,7 +142,6 @@ export default function Timeline() {const [aiInput, setAiInput] = useState("");const inputRef = useRef<HTMLInputElement>(null);const aiPanelRef = useRef<HTMLDivElement>(null);- const [isHoveringAiPanel, setIsHoveringAiPanel] = useState(false);const [position, setPosition] = useState({ x: 0, y: 0 });const [isDraggingPanel, setIsDraggingPanel] = useState(false);const [dragOffset, setDragOffset] = useState({ x: 0, y: 0 });@@ -231,47 +230,6 @@ export default function Timeline() {};};- const getLoadedTimeRangeStyles = () => {- if (!loadedTimeRange || frames.length === 0)- return { left: "0%", right: "100%" };-- // Find the earliest frame timestamp- const firstFrame = [...frames].sort(- (a, b) =>- new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime()- )[0];- const earliestTime = new Date(firstFrame.timestamp);-- // Create local date objects for today- const startOfDay = new Date();- startOfDay.setHours(0, 0, 0, 0);-- const endOfDay = new Date();- endOfDay.setHours(23, 59, 59, 999);-- // Convert UTC loadedTimeRange to local time- const localStart = new Date(earliestTime);- const localEnd = new Date(loadedTimeRange.end);-- const totalMs = endOfDay.getTime() - startOfDay.getTime();- const startPercent =- ((localStart.getTime() - startOfDay.getTime()) / totalMs) * 100;- const endPercent =- ((localEnd.getTime() - startOfDay.getTime()) / totalMs) * 100;-- // Temporarily return empty values to disable grey areas- return {- right: "0%",- left: "0%",- };-- // Original code commented out:- // return {- // right: `${Math.max(0, Math.min(100, startPercent))}%`, // Grey before data starts- // left: `${Math.max(0, Math.min(100, 100 - endPercent))}%`, // Grey after data ends- // };- };-useEffect(() => {setupEventSource();@@ -787,21 +745,9 @@ export default function Timeline() {onMouseUp={handleTimelineMouseUp}onMouseLeave={handleTimelineMouseUp}>- <div- className="absolute inset-0 pointer-events-none"- style={{- ...getLoadedTimeRangeStyles(),- background:- "linear-gradient(to right, rgba(255,255,255,0.8), rgba(255,255,255,0.2))",- }}- />-- {/* {loadedTimeRange && (- <TimelineBlocks- frames={frames}- timeRange={loadedTimeRange}- />- )} */}+ {loadedTimeRange && (+ <TimelineBlocks frames={frames} timeRange={loadedTimeRange} />+ )}<divclassName="absolute inset-0"diff --git a/screenpipe-app-tauri/components/timeline/timeline-block.tsx b/screenpipe-app-tauri/components/timeline/timeline-block.tsxindex aa08bfcd1..f481416e6 100644--- a/screenpipe-app-tauri/components/timeline/timeline-block.tsx+++ b/screenpipe-app-tauri/components/timeline/timeline-block.tsx@@ -1,25 +1,27 @@+import { StreamTimeSeriesResponse } from "@/app/timeline/page";import { useMemo } from "react";interface TimeBlock {appName: string;+ windowName: string;startTime: Date;endTime: Date;color: string;}interface TimelineBlocksProps {- frames: any[]; // Replace with your StreamTimeSeriesResponse type+ frames: StreamTimeSeriesResponse[];timeRange: { start: Date; end: Date };}export function TimelineBlocks({ frames, timeRange }: TimelineBlocksProps) {// Cache colors to avoid recalculatingconst colorCache = useMemo(() => new Map<string, string>(), []);-+const getAppColor = (appName: string): string => {const cached = colorCache.get(appName);if (cached) return cached;-+let hash = 0;for (let i = 0; i < appName.length; i++) {hash = appName.charCodeAt(i) + ((hash << 5) - hash);@@ -30,72 +32,89 @@ export function TimelineBlocks({ frames, timeRange }: TimelineBlocksProps) {return color;};- // Optimize block calculation by sampling frames+ // Calculate blocks without samplingconst blocks = useMemo(() => {if (frames.length === 0) return [];- // Sample frames based on time range duration- const timeRangeMs = timeRange.end.getTime() - timeRange.start.getTime();- const sampleInterval = Math.max(1, Math.floor(timeRangeMs / 200)); // Adjust 200 to control detail level-- const sampledFrames = frames.filter((_, index) => index % sampleInterval === 0);-const blocks: TimeBlock[] = [];let currentBlock: TimeBlock | null = null;- sampledFrames- .sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime())- .forEach((frame) => {- const timestamp = new Date(frame.timestamp);- const appName = frame.devices[0].metadata.app_name;-- if (timestamp < timeRange.start || timestamp > timeRange.end) return;-- if (!currentBlock) {- currentBlock = {- appName,- startTime: timestamp,- endTime: timestamp,- color: getAppColor(appName),- };- } else if (currentBlock.appName !== appName) {- blocks.push(currentBlock);- currentBlock = {- appName,- startTime: timestamp,- endTime: timestamp,- color: getAppColor(appName),- };- } else {- currentBlock.endTime = timestamp;- }- });+ // Sort frames by timestamp first+ const sortedFrames = [...frames].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;+ const windowName = frame.devices[0].metadata.window_name;+ if (timestamp < timeRange.start || timestamp > timeRange.end) return;++ if (!currentBlock) {+ currentBlock = {+ appName,+ windowName,+ startTime: timestamp,+ endTime: timestamp,+ color: getAppColor(appName),+ };+ } else if (currentBlock.appName !== appName) {+ blocks.push(currentBlock);+ currentBlock = {+ appName,+ windowName,+ startTime: timestamp,+ endTime: timestamp,+ color: getAppColor(appName),+ };+ } else {+ currentBlock.endTime = timestamp;+ }+ });if (currentBlock) blocks.push(currentBlock);return blocks;- }, [frames, timeRange, colorCache]);+ }, [frames, timeRange, getAppColor]);++ // Debug output+ console.log("timeline blocks:", blocks);- // Optimize rendering by using CSS transform instead of percentage calculationsreturn (<div className="absolute inset-0">{blocks.map((block, index) => {- const totalMs = timeRange.end.getTime() - timeRange.start.getTime();- const blockStart = (block.startTime.getTime() - timeRange.start.getTime()) / totalMs;- const blockWidth = (block.endTime.getTime() - block.startTime.getTime()) / totalMs;+ // Convert block times to hours since start of day for proper scaling+ const blockStartHours =+ block.startTime.getHours() ++ block.startTime.getMinutes() / 60 ++ block.startTime.getSeconds() / 3600;+ const blockEndHours =+ block.endTime.getHours() ++ block.endTime.getMinutes() / 60 ++ block.endTime.getSeconds() / 3600;++ // Calculate position and width based on 24-hour scale+ const blockStart = (blockStartHours / 24) * 100;+ const blockWidth = ((blockEndHours - blockStartHours) / 24) * 100;- if (blockWidth < 0.001) return null; // Skip tiny blocks+ if (blockWidth < 0.1) return null; // Skip tiny blocksreturn (<divkey={`${block.appName}-${index}`}- className="absolute top-0 h-full"+ className="absolute top-0 h-full opacity-50 hover:opacity-80 transition-opacity z-10"style={{- transform: `translateX(${blockStart * 100}%)`,- width: `${blockWidth * 100}%`,+ left: `${blockStart}%`,+ width: `${blockWidth}%`,backgroundColor: block.color,- willChange: 'transform',+ willChange: "transform",}}- title={`${block.appName}\n${block.startTime.toLocaleTimeString()} - ${block.endTime.toLocaleTimeString()}`}+ title={`${block.appName}\n${+ block.windowName+ }\n${block.startTime.toLocaleTimeString()} - ${block.endTime.toLocaleTimeString()}`}/>);})}diff --git a/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/screenpipe-app-tauri/lib/hooks/use-settings.tsxindex af410e0d1..b1fb48067 100644--- a/screenpipe-app-tauri/lib/hooks/use-settings.tsx+++ b/screenpipe-app-tauri/lib/hooks/use-settings.tsx@@ -255,6 +255,7 @@ export function useSettings() {"Clock","Dock","DeepL",+ "Control Center",]: currentPlatform === "windows"? [diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lockindex 7f027898b..a07b3b4f9 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.5"+version = "0.9.6"dependencies = ["anyhow","axum",diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rsindex c819fca90..31cb24993 100644--- a/screenpipe-server/src/bin/screenpipe-server.rs+++ b/screenpipe-server/src/bin/screenpipe-server.rs@@ -613,8 +613,6 @@ async fn main() -> anyhow::Result<()> {}}- println!("├─────────────────────┼────────────────────────────────────┤");- println!("│ ui monitoring │ {:<34} │", cli.enable_ui_monitoring);println!("└─────────────────────┴────────────────────────────────────┘");// Add warning for cloud arguments and telemetry