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: keep screenpipe visible in Windows taskbar

Louis Beaumont6b942a5a3d51
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index 8872842f6..3dd9f033e 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -1350,11 +1350,12 @@ async fn main() {
let _ = window.set_visible_on_all_workspaces(false);
#[cfg(target_os = "macos")]
crate::window_api::reset_to_regular_and_refresh_tray(window.app_handle());
- // On Windows, minimize the main windowed window so it stays
- // visible in the taskbar instead of vanishing to the tray.
+ // On Windows, minimize main windows so they stay visible in the
+ // taskbar instead of vanishing to the tray. Only hide non-main
+ // windows (e.g. notifications, settings).
#[cfg(target_os = "windows")]
{
- if window.label() == "main-window" {
+ if window.label() == "main-window" || window.label() == "main" {
let _ = window.minimize();
} else {
let _ = window.hide();
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs b/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
index 8853764a5..45fdb0077 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
@@ -1450,8 +1450,9 @@ impl ShowRewindWindow {
.position(position.x as f64, position.y as f64);
let win = builder.build()?;
- // Setup Win32 overlay with click-through disabled so user can interact
- if let Err(e) = crate::windows_overlay::setup_overlay(&win, false) {
+ // Setup Win32 overlay with click-through disabled so user can interact.
+ // show_in_taskbar=true so the app remains visible in the Windows taskbar.
+ if let Err(e) = crate::windows_overlay::setup_overlay_ex(&win, false, true) {
error!("Failed to setup Windows overlay: {}", e);
}
@@ -1902,12 +1903,12 @@ impl ShowRewindWindow {
}
#[cfg(target_os = "windows")]
{
- // Hide instead of close/destroy so the webview survives for reopen.
- // Destroying the window causes re-creation with visible(false) and
- // the overlay show path never makes it visible again.
+ // Minimize instead of hide so the window stays in the taskbar.
+ // hide() removes the window from the taskbar entirely on Windows.
+ // The webview survives a minimize just as it survives a hide.
for label in &["main", "main-window"] {
if let Some(window) = app.get_webview_window(label) {
- window.hide().ok();
+ window.minimize().ok();
}
}
}
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/windows_overlay.rs b/apps/screenpipe-app-tauri/src-tauri/src/windows_overlay.rs
index a7c2e0503..117fe7a32 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/windows_overlay.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/windows_overlay.rs
@@ -48,10 +48,21 @@ pub fn get_hwnd(window: &WebviewWindow) -> Option<HWND> {
///
/// This sets up the window with:
/// - WS_EX_LAYERED: Required for transparency and click-through
-/// - WS_EX_TOOLWINDOW: Prevents showing in taskbar/alt-tab
-/// - WS_EX_NOACTIVATE: Prevents stealing focus
+/// - WS_EX_TOOLWINDOW: Prevents showing in taskbar/alt-tab (unless show_in_taskbar is true)
/// - HWND_TOPMOST: Always on top of other windows
+///
+/// Set `show_in_taskbar` to true for the main overlay window so the app
+/// remains visible in the Windows taskbar.
pub fn setup_overlay(window: &WebviewWindow, click_through: bool) -> Result<(), String> {
+ setup_overlay_ex(window, click_through, false)
+}
+
+/// Like `setup_overlay` but with explicit taskbar visibility control.
+pub fn setup_overlay_ex(
+ window: &WebviewWindow,
+ click_through: bool,
+ show_in_taskbar: bool,
+) -> Result<(), String> {
let hwnd = get_hwnd(window).ok_or("Failed to get HWND")?;
unsafe {
@@ -61,6 +72,11 @@ pub fn setup_overlay(window: &WebviewWindow, click_through: bool) -> Result<(),
// Build new style with overlay flags
let mut new_style = current_style | OVERLAY_EX_STYLE;
+ // Remove WS_EX_TOOLWINDOW if the window should appear in the taskbar
+ if show_in_taskbar {
+ new_style &= !(WS_EX_TOOLWINDOW.0 as i32);
+ }
+
if click_through {
new_style |= CLICK_THROUGH_STYLE;
}