Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Adjust Main window size/zoom on Windows and UI
Richie McIlroy79ecbd8f88c0
diff --git a/apps/desktop/src-tauri/src/windows.rs b/apps/desktop/src-tauri/src/windows.rsindex a2ad65fd5..f067d60f0 100644--- a/apps/desktop/src-tauri/src/windows.rs+++ b/apps/desktop/src-tauri/src/windows.rs@@ -883,7 +883,13 @@ impl CapWindowId {pub fn min_size(&self) -> Option<(f64, f64)> {Some(match self {- Self::Main => (330.0, 395.0),+ Self::Main => {+ #[cfg(windows)]+ let height = 430.0;+ #[cfg(not(windows))]+ let height = 395.0;+ (330.0, height)+ }Self::Editor { .. } => (1275.0, 800.0),Self::ScreenshotEditor { .. } => (800.0, 600.0),Self::Settings => (780.0, 560.0),@@ -1390,6 +1396,7 @@ impl ShowCapWindow {.content_protected(should_protect).transparent(true).visible(false)+ .zoom_hotkeys_enabled(false).initialization_script(format!("window.__CAP__ = window.__CAP__ ?? {{}};@@ -1400,6 +1407,10 @@ impl ShowCapWindow {)).build()?;+ if let Err(e) = window.set_zoom(1.0) {+ warn!("Failed to lock Main window zoom to 1.0: {}", e);+ }+let saved_position = GeneralSettingsStore::get(app).ok().flatten()@@ -1409,7 +1420,11 @@ impl ShowCapWindow {let (pos_x, pos_y) = if let Some(pos) = saved_position {(pos.x, pos.y)} else {- cursor_monitor.center_position(330.0, 395.0)+ #[cfg(windows)]+ let center_height = 430.0;+ #[cfg(not(windows))]+ let center_height = 395.0;+ cursor_monitor.center_position(330.0, center_height)};#[cfg(target_os = "macos")]@@ -1464,6 +1479,19 @@ impl ShowCapWindow {#[cfg(not(target_os = "macos"))]{let _ = window.set_position(tauri::LogicalPosition::new(pos_x, pos_y));++ #[cfg(windows)]+ {+ if let Err(e) = window.set_size(LogicalSize::new(330.0, 430.0)) {+ warn!("Failed to set Main window size on Windows: {}", e);+ }+ if let Err(e) =+ window.set_position(tauri::LogicalPosition::new(pos_x, pos_y))+ {+ warn!("Failed to position Main window on Windows: {}", e);+ }+ }+window.show().ok();}diff --git a/apps/desktop/src/routes/(window-chrome).tsx b/apps/desktop/src/routes/(window-chrome).tsxindex d2b63fde5..1ff33c01c 100644--- a/apps/desktop/src/routes/(window-chrome).tsx+++ b/apps/desktop/src/routes/(window-chrome).tsx@@ -142,7 +142,7 @@ function Inner(props: ParentProps) {return (<divdata-tauri-drag-region="false"- class="cap-window-body flex overflow-y-hidden flex-col flex-1 animate-in fade-in"+ class="cap-window-body flex overflow-hidden flex-col flex-1 animate-in fade-in">{props.children}</div>diff --git a/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx b/apps/desktop/src/routes/(window-chrome)/new-main/index.tsxindex 1ef0a048e..0e2d3d6a7 100644--- a/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx+++ b/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx@@ -14,6 +14,7 @@ import {} from "@tauri-apps/api/webviewWindow";import { getCurrentWindow, LogicalSize } from "@tauri-apps/api/window";import * as dialog from "@tauri-apps/plugin-dialog";+import { type as ostype } from "@tauri-apps/plugin-os";import * as shell from "@tauri-apps/plugin-shell";import * as updater from "@tauri-apps/plugin-updater";import { cx } from "cva";@@ -106,7 +107,10 @@ import TargetMenuGrid from "./TargetMenuGrid";import TargetTypeButton from "./TargetTypeButton";import useRequestPermission from "./useRequestPermission";-const WINDOW_SIZE = { width: 330, height: 395 } as const;+const WINDOW_SIZE = {+ width: 330,+ height: ostype() === "windows" ? 430 : 395,+} as const;const CAPTURE_LIST_STALE_TIME = 5_000;const CAPTURE_LIST_GC_TIME = 60_000;const CAPTURE_THUMBNAIL_STALE_TIME = 10_000;diff --git a/apps/desktop/src/routes/(window-chrome)/settings.tsx b/apps/desktop/src/routes/(window-chrome)/settings.tsxindex ed59b88c4..2ff007a2d 100644--- a/apps/desktop/src/routes/(window-chrome)/settings.tsx+++ b/apps/desktop/src/routes/(window-chrome)/settings.tsx@@ -174,7 +174,7 @@ export default function Settings(props: RouteSectionProps) {<div class="cap-settings-window-spacer" data-tauri-drag-region /><buttontype="button"- class="cap-settings-profile"+ class="cap-settings-profile flex gap-2 items-center mx-2 mt-2 mb-3 px-2 py-1.5 rounded-lg text-left transition-colors hover:bg-gray-3"data-tauri-drag-region="false"onClick={openDashboard}>@@ -182,10 +182,10 @@ export default function Settings(props: RouteSectionProps) {when={!accountLoading()}fallback={<>- <div class="cap-settings-profile-icon cap-settings-profile-skeleton cap-settings-profile-skeleton-avatar" />- <div class="cap-settings-profile-copy">- <span class="cap-settings-profile-skeleton cap-settings-profile-skeleton-title" />- <span class="cap-settings-profile-skeleton cap-settings-profile-skeleton-subtitle" />+ <div class="cap-settings-profile-icon cap-settings-profile-skeleton cap-settings-profile-skeleton-avatar size-8 shrink-0 rounded-full bg-gray-4 animate-pulse" />+ <div class="cap-settings-profile-copy flex flex-col flex-1 gap-1.5 min-w-0">+ <span class="cap-settings-profile-skeleton cap-settings-profile-skeleton-title block h-3 w-24 rounded-full bg-gray-4 animate-pulse" />+ <span class="cap-settings-profile-skeleton cap-settings-profile-skeleton-subtitle block h-2.5 w-12 rounded-full bg-gray-4 animate-pulse" /></div></>}@@ -193,21 +193,21 @@ export default function Settings(props: RouteSectionProps) {<Showwhen={accountImageUrl()}fallback={- <div class="cap-settings-profile-icon">+ <div class="cap-settings-profile-icon flex justify-center items-center size-8 shrink-0 rounded-full bg-gray-3 text-gray-11"><IconLucideUserRound class="size-4" aria-hidden="true" /></div>}>{(imageUrl) => (<img- class="cap-settings-profile-image"+ class="cap-settings-profile-image size-8 shrink-0 rounded-full object-cover bg-gray-3"src={imageUrl()}alt=""draggable={false}/>)}</Show>- <div class="cap-settings-profile-copy">+ <div class="cap-settings-profile-copy flex flex-col flex-1 gap-0.5 min-w-0"><p class="truncate text-[13px] text-gray-12">{accountName()}</p><p class="truncate text-[11px] text-gray-10">Account</p></div>