Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

always decorations(false) on windows

Brendan Allan9e29184b8998
diff --git a/apps/desktop/src-tauri/src/windows.rs b/apps/desktop/src-tauri/src/windows.rs
index c6c19aa6f..15d651ad0 100644
--- a/apps/desktop/src-tauri/src/windows.rs
+++ b/apps/desktop/src-tauri/src/windows.rs
@@ -1,20 +1,17 @@
#![allow(unused_mut)]
#![allow(unused_imports)]
-use crate::{
- App, ArcLock, camera::CameraPreview, fake_window, general_settings::AppTheme, permissions,
-};
+use crate::{App, ArcLock, fake_window, general_settings::AppTheme, permissions};
use cap_flags::FLAGS;
use cap_media::{platform::logical_monitor_bounds, sources::CaptureScreen};
-use futures::{executor::block_on, pin_mut};
+use futures::pin_mut;
use serde::Deserialize;
use specta::Type;
use std::{
- borrow::Cow,
ops::Deref,
path::PathBuf,
str::FromStr,
- sync::{Arc, Mutex, atomic::AtomicU32, mpsc},
+ sync::{Arc, Mutex, atomic::AtomicU32},
};
use tauri::{
AppHandle, LogicalPosition, Manager, Monitor, PhysicalPosition, PhysicalSize, WebviewUrl,
@@ -133,14 +130,6 @@ impl CapWindowId {
app.get_webview_window(&label)
}
- #[cfg(target_os = "windows")]
- pub fn should_have_decorations(&self) -> bool {
- matches!(
- self,
- Self::Setup | Self::Settings | Self::Editor { .. } | Self::ModeSelect
- )
- }
-
#[cfg(target_os = "macos")]
pub fn traffic_lights_position(&self) -> Option<Option<LogicalPosition<f64>>> {
match self {
@@ -178,7 +167,7 @@ pub enum ShowCapWindow {
WindowCaptureOccluder { screen_id: u32 },
CaptureArea { screen_id: u32 },
Camera,
- InProgressRecording { countdown: Option<u32> },
+ InProgressRecording { position: Option<(f64, f64)> },
Upgrade,
ModeSelect,
}
@@ -320,6 +309,8 @@ impl ShowCapWindow {
Self::Camera => {
const WINDOW_SIZE: f64 = 230.0 * 2.0;
+ let port = app.state::<Arc<RwLock<App>>>().read().await.camera_ws_port;
+
let mut window_builder = self
.window_builder(app, "/camera")
.maximized(false)
@@ -335,8 +326,13 @@ impl ShowCapWindow {
- WINDOW_SIZE
- 100.0,
)
- .transparent(true)
- .visible(false); // We set this true in `CameraWindowState::init_window`
+ .initialization_script(&format!(
+ "
+ window.__CAP__ = window.__CAP__ ?? {{}};
+ window.__CAP__.cameraWsPort = {port};
+ ",
+ ))
+ .transparent(true);
let window = window_builder.build()?;
@@ -436,8 +432,11 @@ impl ShowCapWindow {
window
}
- Self::InProgressRecording { countdown } => {
- let width = 244.0;
+ Self::InProgressRecording {
+ position: _position,
+ } => {
+ let mut width = 180.0 + 32.0;
+
let height = 40.0;
let window = self
@@ -456,10 +455,6 @@ impl ShowCapWindow {
(monitor.size().height as f64) / monitor.scale_factor() - height - 120.0,
)
.skip_taskbar(true)
- .initialization_script(format!(
- "window.COUNTDOWN = {};",
- countdown.unwrap_or_default()
- ))
.build()?;
#[cfg(target_os = "macos")]