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
feat: add timeline icon in linux (#745)
tribhuwanaf2cdde185dd
diff --git a/screenpipe-app-tauri/components/timeline/timeline-dock-section.tsx b/screenpipe-app-tauri/components/timeline/timeline-dock-section.tsxindex d9864e74f..bbf99e9ab 100644--- a/screenpipe-app-tauri/components/timeline/timeline-dock-section.tsx+++ b/screenpipe-app-tauri/components/timeline/timeline-dock-section.tsx@@ -34,6 +34,7 @@ export function TimelineIconsSection({}: {blocks: StreamTimeSeriesResponse[];}) {+ const os = platform();const [iconCache, setIconCache] = useState<{ [key: string]: string }>({});const [selectedApp, setSelectedApp] = useState<ProcessedBlock | null>(null);const { setSelectionRange } = useTimelineSelection();@@ -242,7 +243,11 @@ export function TimelineIconsSection({}}><img- src={`data:image/png;base64,${block.iconSrc}`}+ src={+ os === "linux"+ ? `data:image/svg+xml;base64,${block.iconSrc}`+ : `data:image/png;base64,${block.iconSrc}`+ }className="w-full h-full opacity-70"alt={block.appName}loading="lazy"@@ -302,7 +307,11 @@ export function TimelineIconsSection({<div className="flex items-center gap-2">{selectedApp?.iconSrc && (<img- src={`data:image/png;base64,${selectedApp.iconSrc}`}+ src={+ os === "linux"+ ? `data:image/svg+xml;base64,${selectedApp.iconSrc}`+ : `data:image/png;base64,${selectedApp.iconSrc}`+ }className="w-6 h-6"alt={selectedApp.appName}/>diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.tomlindex 447022aaf..3610f37a7 100644--- a/screenpipe-app-tauri/src-tauri/Cargo.toml+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml@@ -97,6 +97,10 @@ base64 = "0.22.1"winreg = "0.52.0"windows-icons = { git = "https://github.com/tribhuwan-kumar/windows-icons.git" }+[target.'cfg(target_os = "linux")'.dependencies]+gtk = "0.18.1"+base64 = "0.22.1"+[features]cudart = []metal = []diff --git a/screenpipe-app-tauri/src-tauri/src/icons.rs b/screenpipe-app-tauri/src-tauri/src/icons.rsindex cfa9210ce..99333a49b 100644--- a/screenpipe-app-tauri/src-tauri/src/icons.rs+++ b/screenpipe-app-tauri/src-tauri/src/icons.rs@@ -267,8 +267,32 @@ pub async fn get_app_icon(app_name: &str,app_path: Option<String>,) -> Result<Option<AppIcon>, String> {- // Linux: Check XDG icon themes- // Convert to base64- // Return AppIcon struct- Ok(None)+ use std::fs;+ use gtk::prelude::IconThemeExt;+ use base64::{engine::general_purpose::STANDARD, Engine};++ if gtk::init().is_err() {+ return Err("failed to initialize GTK".to_string());+ }++ fn find_icon_path(app_name: &str) -> Option<String> {+ let icon_theme = gtk::IconTheme::default().unwrap();+ let icon_info = icon_theme.lookup_icon(app_name, 64, gtk::IconLookupFlags::empty())?;+ icon_info.filename().map(|s| s.to_string_lossy().into_owned())+ }++ let path = match app_path {+ Some(p) => p,+ None => find_icon_path(app_name).ok_or_else(|| "could not find icon path".to_string())?,+ };++ // base64 will be in svg!+ let icon_data = fs::read(&path).map_err(|e| e.to_string())?;+ let base64 = STANDARD.encode(&icon_data);++ Ok(Some(AppIcon {+ base64,+ path: Some(path),+ }))}+