Skip to content

Commit 4804fd1

Browse files
committed
Rename Setup window to Onboarding
1 parent a06d8f1 commit 4804fd1

File tree

7 files changed

+17
-620
lines changed

7 files changed

+17
-620
lines changed

apps/desktop/src-tauri/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3348,7 +3348,7 @@ pub async fn run(recording_logging_handle: LoggingHandle, logs_dir: PathBuf) {
33483348
flags
33493349
})
33503350
.with_denylist(&[
3351-
CapWindowId::Setup.label().as_str(),
3351+
CapWindowId::Onboarding.label().as_str(),
33523352
CapWindowId::Main.label().as_str(),
33533353
"window-capture-occluder",
33543354
"target-select-overlay",
@@ -3893,7 +3893,7 @@ pub async fn run(recording_logging_handle: LoggingHandle, logs_dir: PathBuf) {
38933893
|| label.starts_with("screenshot-editor-")
38943894
|| label.as_str() == "settings"
38953895
|| label.as_str() == "signin"
3896-
|| label.as_str() == "setup"
3896+
|| label.as_str() == "onboarding"
38973897
});
38983898

38993899
if has_window {
@@ -3905,7 +3905,7 @@ pub async fn run(recording_logging_handle: LoggingHandle, logs_dir: PathBuf) {
39053905
|| label.starts_with("screenshot-editor-")
39063906
|| label.as_str() == "settings"
39073907
|| label.as_str() == "signin"
3908-
|| label.as_str() == "setup"
3908+
|| label.as_str() == "onboarding"
39093909
})
39103910
.map(|(_, window)| window.clone())
39113911
{

apps/desktop/src-tauri/src/tray.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ fn get_current_mode(app: &AppHandle) -> RecordingMode {
330330
.unwrap_or_default()
331331
}
332332

333-
fn is_setup_window_open(app: &AppHandle) -> bool {
334-
app.webview_windows().contains_key("setup")
333+
fn is_onboarding_window_open(app: &AppHandle) -> bool {
334+
app.webview_windows().contains_key("onboarding")
335335
}
336336

337337
fn create_mode_submenu(app: &AppHandle) -> tauri::Result<Submenu<tauri::Wry>> {
@@ -365,7 +365,7 @@ fn create_mode_submenu(app: &AppHandle) -> tauri::Result<Submenu<tauri::Wry>> {
365365
}
366366

367367
fn build_tray_menu(app: &AppHandle, cache: &PreviousItemsCache) -> tauri::Result<Menu<tauri::Wry>> {
368-
if is_setup_window_open(app) {
368+
if is_onboarding_window_open(app) {
369369
return Menu::with_items(
370370
app,
371371
&[
@@ -809,7 +809,7 @@ pub fn create_tray(app: &AppHandle) -> tauri::Result<()> {
809809
Ok(TrayItem::RequestPermissions) => {
810810
let app = app.clone();
811811
tokio::spawn(async move {
812-
let _ = ShowCapWindow::Setup.show(&app).await;
812+
let _ = ShowCapWindow::Onboarding.show(&app).await;
813813
});
814814
}
815815
_ => {}

apps/desktop/src-tauri/src/windows.rs

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,6 @@ fn is_position_on_any_screen(pos_x: f64, pos_y: f64) -> bool {
379379

380380
#[derive(Clone, Deserialize, Type)]
381381
pub enum CapWindowId {
382-
// Contains onboarding + permissions
383-
Setup,
384382
Main,
385383
Settings,
386384
Editor { id: u32 },
@@ -402,7 +400,6 @@ impl FromStr for CapWindowId {
402400

403401
fn from_str(s: &str) -> Result<Self, Self::Err> {
404402
Ok(match s {
405-
"setup" => Self::Setup,
406403
"main" => Self::Main,
407404
"settings" => Self::Settings,
408405
"camera" => Self::Camera,
@@ -446,7 +443,6 @@ impl FromStr for CapWindowId {
446443
impl std::fmt::Display for CapWindowId {
447444
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
448445
match self {
449-
Self::Setup => write!(f, "setup"),
450446
Self::Main => write!(f, "main"),
451447
Self::Settings => write!(f, "settings"),
452448
Self::Camera => write!(f, "camera"),
@@ -476,7 +472,6 @@ impl CapWindowId {
476472

477473
pub fn title(&self) -> String {
478474
match self {
479-
Self::Setup => "Cap Setup".to_string(),
480475
Self::Settings => "Cap Settings".to_string(),
481476
Self::WindowCaptureOccluder { .. } => "Cap Window Capture Occluder".to_string(),
482477
Self::CaptureArea => "Cap Capture Area".to_string(),
@@ -495,8 +490,7 @@ impl CapWindowId {
495490
pub fn activates_dock(&self) -> bool {
496491
matches!(
497492
self,
498-
Self::Setup
499-
| Self::Main
493+
Self::Main
500494
| Self::Editor { .. }
501495
| Self::ScreenshotEditor { .. }
502496
| Self::Settings
@@ -543,7 +537,6 @@ impl CapWindowId {
543537

544538
pub fn min_size(&self) -> Option<(f64, f64)> {
545539
Some(match self {
546-
Self::Setup => (600.0, 600.0),
547540
Self::Main => (330.0, 395.0),
548541
Self::Editor { .. } => (1275.0, 800.0),
549542
Self::ScreenshotEditor { .. } => (800.0, 600.0),
@@ -559,7 +552,6 @@ impl CapWindowId {
559552

560553
#[derive(Debug, Clone, Type, Deserialize)]
561554
pub enum ShowCapWindow {
562-
Setup,
563555
Main {
564556
init_target_mode: Option<RecordingTargetMode>,
565557
},
@@ -930,6 +922,12 @@ impl ShowCapWindow {
930922
if !matches!(self, Self::Camera { .. } | Self::InProgressRecording { .. })
931923
&& let Some(window) = self.id(app).get(app)
932924
{
925+
if matches!(self, Self::Main { .. })
926+
&& !permissions::do_permissions_check(false).necessary_granted()
927+
{
928+
return Box::pin(Self::Onboarding.show(app)).await;
929+
}
930+
933931
let cursor_display_id = if let Self::Main { init_target_mode } = self {
934932
if init_target_mode.is_some() {
935933
Display::get_containing_cursor()
@@ -973,37 +971,6 @@ impl ShowCapWindow {
973971
let cursor_monitor = CursorMonitorInfo::get();
974972

975973
let window = match self {
976-
Self::Setup => {
977-
let window = self
978-
.window_builder(app, "/setup")
979-
.inner_size(600.0, 600.0)
980-
.min_inner_size(600.0, 600.0)
981-
.resizable(false)
982-
.maximized(false)
983-
.focused(true)
984-
.maximizable(false)
985-
.shadow(true)
986-
.build()?;
987-
988-
let (pos_x, pos_y) = cursor_monitor.center_position(600.0, 600.0);
989-
let _ = window.set_position(tauri::LogicalPosition::new(pos_x, pos_y));
990-
991-
#[cfg(windows)]
992-
{
993-
use tauri::LogicalSize;
994-
if let Err(e) = window.set_size(LogicalSize::new(600.0, 600.0)) {
995-
warn!("Failed to set Setup window size on Windows: {}", e);
996-
}
997-
if let Err(e) = window.set_position(tauri::LogicalPosition::new(pos_x, pos_y)) {
998-
warn!("Failed to position Setup window on Windows: {}", e);
999-
}
1000-
}
1001-
1002-
window.show().ok();
1003-
window.set_focus().ok();
1004-
1005-
window
1006-
}
1007974
Self::Main { init_target_mode } => {
1008975
if !permissions::do_permissions_check(false).necessary_granted() {
1009976
return Box::pin(Self::Onboarding.show(app)).await;
@@ -2155,7 +2122,6 @@ impl ShowCapWindow {
21552122

21562123
pub fn id(&self, app: &AppHandle) -> CapWindowId {
21572124
match self {
2158-
ShowCapWindow::Setup => CapWindowId::Setup,
21592125
ShowCapWindow::Main { .. } => CapWindowId::Main,
21602126
ShowCapWindow::Settings { .. } => CapWindowId::Settings,
21612127
ShowCapWindow::Editor { project_path } => {

apps/desktop/src/App.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import titlebar from "./utils/titlebar-state";
2020

2121
const WindowChromeLayout = lazy(() => import("./routes/(window-chrome)"));
2222
const NewMainPage = lazy(() => import("./routes/(window-chrome)/new-main"));
23-
const SetupPage = lazy(() => import("./routes/(window-chrome)/setup"));
2423
const SettingsLayout = lazy(() => import("./routes/(window-chrome)/settings"));
2524
const SettingsGeneralPage = lazy(
2625
() => import("./routes/(window-chrome)/settings/general"),
@@ -148,7 +147,6 @@ function Inner() {
148147
>
149148
<Route path="/" component={WindowChromeLayout}>
150149
<Route path="/" component={NewMainPage} />
151-
<Route path="/setup" component={SetupPage} />
152150
<Route path="/settings" component={SettingsLayout}>
153151
<Route path="/" component={SettingsGeneralPage} />
154152
<Route path="/general" component={SettingsGeneralPage} />

0 commit comments

Comments
 (0)