Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(desktop): native-style window chrome and full-display overlays on Linux
Richie McIlroy3bb564f3d8e4
diff --git a/apps/desktop/src-tauri/src/windows.rs b/apps/desktop/src-tauri/src/windows.rsindex edb78ff3a..604fb436a 100644--- a/apps/desktop/src-tauri/src/windows.rs+++ b/apps/desktop/src-tauri/src/windows.rs@@ -1595,9 +1595,27 @@ impl ShowCapWindow {window_builder = window_builder.inner_size(100.0, 100.0).position(0.0, 0.0);}+ #[cfg(target_os = "linux")]+ {+ let position = display.raw_handle().physical_position().unwrap();+ let size = display.physical_size().unwrap();+ window_builder = window_builder+ .inner_size(size.width(), size.height())+ .position(position.x(), position.y());+ }+let window = window_builder.build()?;lock_window_text_scale(&window);+ #[cfg(target_os = "linux")]+ {+ use tauri::{LogicalSize, PhysicalPosition};+ let position = display.raw_handle().physical_position().unwrap();+ let size = display.physical_size().unwrap();+ let _ = window.set_position(PhysicalPosition::new(position.x(), position.y()));+ let _ = window.set_size(LogicalSize::new(size.width(), size.height()));+ }+#[cfg(windows)]{let position = display.raw_handle().physical_position().unwrap();@@ -2297,9 +2315,27 @@ impl ShowCapWindow {.position(bounds.position().x(), bounds.position().y());}+ #[cfg(target_os = "linux")]+ if let Some(bounds) = display.raw_handle().physical_bounds() {+ window_builder = window_builder+ .inner_size(bounds.size().width(), bounds.size().height())+ .position(bounds.position().x(), bounds.position().y());+ }+let window = window_builder.build()?;lock_window_text_scale(&window);+ #[cfg(target_os = "linux")]+ if let Some(bounds) = display.raw_handle().physical_bounds() {+ use tauri::{LogicalSize, PhysicalPosition};+ let _ = window.set_position(PhysicalPosition::new(+ bounds.position().x(),+ bounds.position().y(),+ ));+ let _ = window+ .set_size(LogicalSize::new(bounds.size().width(), bounds.size().height()));+ }+#[cfg(target_os = "macos")]crate::platform::set_window_level(window.as_ref().window(),@@ -2640,6 +2676,13 @@ impl ShowCapWindow {builder = builder.decorations(false).zoom_hotkeys_enabled(false);}+ // Linux has no native macOS-style traffic lights, so we drop the window+ // manager decorations and draw our own chrome (matching the macOS layout).+ #[cfg(target_os = "linux")]+ {+ builder = builder.decorations(false);+ }+builder}diff --git a/apps/desktop/src/routes/(window-chrome).tsx b/apps/desktop/src/routes/(window-chrome).tsxindex 1ff33c01c..e99e68d2b 100644--- a/apps/desktop/src/routes/(window-chrome).tsx+++ b/apps/desktop/src/routes/(window-chrome).tsx@@ -102,6 +102,7 @@ function Header() {const isWindows = ostype() === "windows";const isMacOS = ostype() === "macos";+ const isLinux = ostype() === "linux";const isSettings = () => location.pathname.startsWith("/settings");if (isMacOS && isSettings()) return null;@@ -116,7 +117,7 @@ function Header() {>{ctx.state()?.items}{isWindows && <CaptionControlsWindows11 class="ml-auto!" />}- {isMacOS && !isSettings() && (+ {((isMacOS && !isSettings()) || isLinux) && (<CaptionControlsMacOSclass="mr-auto! ml-3"showMinimize={false}diff --git a/apps/desktop/src/routes/editor/Header.tsx b/apps/desktop/src/routes/editor/Header.tsxindex c2e0a05b6..f818d8333 100644--- a/apps/desktop/src/routes/editor/Header.tsx+++ b/apps/desktop/src/routes/editor/Header.tsx@@ -22,6 +22,7 @@ import {import { produce } from "solid-js/store";import toast from "solid-toast";import Tooltip from "~/components/Tooltip";+import CaptionControlsMacOS from "~/components/titlebar/controls/CaptionControlsMacOS";import CaptionControlsWindows11 from "~/components/titlebar/controls/CaptionControlsWindows11";import { trackEvent } from "~/utils/analytics";import { commands, type RecordingMetaWithMetadata } from "~/utils/tauri";@@ -268,6 +269,7 @@ export function Header() {class={cx("flex flex-row flex-1 gap-2 items-center px-4 h-full")}>{ostype() === "macos" && <div class="h-full w-16" />}+ {ostype() === "linux" && <CaptionControlsMacOS class="mr-1" />}<EditorButtononClick={async () => {clearTimelineSelection();diff --git a/apps/desktop/src/routes/screenshot-editor/Header.tsx b/apps/desktop/src/routes/screenshot-editor/Header.tsxindex ea589cb93..044db0bef 100644--- a/apps/desktop/src/routes/screenshot-editor/Header.tsx+++ b/apps/desktop/src/routes/screenshot-editor/Header.tsx@@ -6,6 +6,7 @@ import { revealItemInDir } from "@tauri-apps/plugin-opener";import { type as ostype } from "@tauri-apps/plugin-os";import { cx } from "cva";import { createEffect, onCleanup, Suspense } from "solid-js";+import CaptionControlsMacOS from "~/components/titlebar/controls/CaptionControlsMacOS";import CaptionControlsWindows11 from "~/components/titlebar/controls/CaptionControlsWindows11";import IconCapCrop from "~icons/cap/crop";import IconCapTrash from "~icons/cap/trash";@@ -99,6 +100,7 @@ export function Header() {><div class="flex items-center gap-4">{ostype() === "macos" && <div class="w-14" />}+ {ostype() === "linux" && <CaptionControlsMacOS />}</div><div class="flex items-center gap-2 absolute left-1/2 -translate-x-1/2">