Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/de.toml
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ instant_copy_link = "Nur Link kopieren"
instant_copy_link_hint = "Nichts wird geöffnet"
instant_open_link = "Link öffnen"
instant_open_link_hint = "In Ihrem Browser"
instant_show_cap = "Cap anzeigen"
instant_show_cap_hint = "Zurück zum Rekorder"
saved_to_library = "In der Bibliothek gespeichert"
screenshot_copy = "Kopieren"
screenshot_copy_and_edit = "Kopieren und bearbeiten"
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ instant_copy_link = "Copy link only"
instant_copy_link_hint = "Nothing opens"
instant_open_link = "Open link"
instant_open_link_hint = "In your browser"
instant_show_cap = "Show Cap"
instant_show_cap_hint = "Back to the recorder"
saved_to_library = "Saved to library"
screenshot_copy = "Copy"
screenshot_copy_and_edit = "Copy and edit"
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/es.toml
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ instant_copy_link = "Solo copiar el enlace"
instant_copy_link_hint = "No se abre nada"
instant_open_link = "Abrir el enlace"
instant_open_link_hint = "En tu navegador"
instant_show_cap = "Mostrar Cap"
instant_show_cap_hint = "Volver a la grabadora"
saved_to_library = "Se guarda en la biblioteca"
screenshot_copy = "Copiar"
screenshot_copy_and_edit = "Copiar y editar"
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/fr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ instant_copy_link = "Copier le lien seulement"
instant_copy_link_hint = "Rien ne s'ouvre"
instant_open_link = "Ouvrir le lien"
instant_open_link_hint = "Dans votre navigateur"
instant_show_cap = "Afficher Cap"
instant_show_cap_hint = "Retour à l'enregistreur"
saved_to_library = "Enregistré dans la bibliothèque"
screenshot_copy = "Copier"
screenshot_copy_and_edit = "Copier et modifier"
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/hi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ instant_copy_link = "सिर्फ़ लिंक कॉपी करें"
instant_copy_link_hint = "कुछ नहीं खुलता"
instant_open_link = "लिंक खोलें"
instant_open_link_hint = "आपके ब्राउज़र में"
instant_show_cap = "Cap दिखाएँ"
instant_show_cap_hint = "रिकॉर्डर पर वापस"
saved_to_library = "लाइब्रेरी में सेव"
screenshot_copy = "कॉपी करें"
screenshot_copy_and_edit = "कॉपी और एडिट"
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/ja.toml
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ instant_copy_link = "リンクのコピーのみ"
instant_copy_link_hint = "何も開きません"
instant_open_link = "リンクを開く"
instant_open_link_hint = "ブラウザで"
instant_show_cap = "Capを表示"
instant_show_cap_hint = "レコーダーに戻る"
saved_to_library = "ライブラリに保存"
screenshot_copy = "コピー"
screenshot_copy_and_edit = "コピーして編集"
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/zh-CN.toml
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ instant_copy_link = "仅复制链接"
instant_copy_link_hint = "不打开任何内容"
instant_open_link = "打开链接"
instant_open_link_hint = "在浏览器中"
instant_show_cap = "显示 Cap"
instant_show_cap_hint = "回到录制器"
saved_to_library = "保存到资料库"
screenshot_copy = "复制"
screenshot_copy_and_edit = "复制并编辑"
Expand Down
49 changes: 41 additions & 8 deletions apps/desktop-gpui/src/app_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@ pub struct AppWindows {
/// copy/save screenshot finish reads it; the cancel reveal keeps the
/// Tauri behaviour above.
pub main_visible_before_picker: bool,
/// [`hide_main_window`] put the main window away and
/// [`show_main_window_after_capture_pause`] has not brought it back since.
/// State the app owns, unlike a visibility probe that also reads a
/// minimized window or a hidden app as gone.
pub main_hidden_by_app: bool,
/// `hiddenForPicker` in the editor's record modal
/// (`ClipsSidebar.tsx:311-341, 413-426`): the editor window that hid
/// itself for an editor-owned target picker ("Record a new clip"). A
Expand Down Expand Up @@ -554,6 +559,7 @@ pub fn init(main: WindowHandle<MainWindow>, session: Entity<RecordingSession>, c
screenshot_editors: Vec::new(),
main_hidden_for_picker: false,
main_visible_before_picker: false,
main_hidden_by_app: false,
editor_hidden_for_picker: None,
camera_park: CameraPark::default(),
#[cfg(target_os = "linux")]
Expand Down Expand Up @@ -613,12 +619,14 @@ pub fn init(main: WindowHandle<MainWindow>, session: Entity<RecordingSession>, c
if !restore_clean_capture_ui(cx) {
return;
}
let (finished_studio, preparing_editor) = session.update(cx, |session, _| {
(
session.finished_studio.take(),
session.take_preparing_studio_editor(),
)
});
let (finished_studio, preparing_editor, finished_instant) =
session.update(cx, |session, _| {
(
session.finished_studio.take(),
session.take_preparing_studio_editor(),
std::mem::take(&mut session.finished_instant),
)
});
// The in-editor re-record target is consumed first, before
// `postStudioRecordingBehaviour` is even consulted -- the order
// `apply_post_studio_editor_behaviour` checks them
Expand Down Expand Up @@ -657,8 +665,23 @@ pub fn init(main: WindowHandle<MainWindow>, session: Entity<RecordingSession>, c
// away. `doNothing` leaves it in the library with Cap out of
// the way. Every other path (instant, failures, `showOverlay`
// until an overlay exists) reshows the main window as before.
let behaviour =
crate::store::GeneralSettings::load().post_studio_recording_behaviour;
// A clean instant recording reshows it only for "Show Cap";
// otherwise the browser tab, or the copied link alone, is
// the completion and Cap stays out of the way.
let settings = crate::store::GeneralSettings::load();
let behaviour = settings.post_studio_recording_behaviour;
// Linux restores the main window through the clean-capture
// lease before this runs, so it keeps reshowing as before. A
// main window reopened mid-recording (even if minimized since)
// takes the reshow too, which resumes its inputs.
let keep_hidden_after_instant = cfg!(not(target_os = "linux"))
&& finished_instant
&& settings.post_instant_behaviour()
!= crate::store::PostInstantBehaviour::ShowCap
&& cx.global::<AppWindows>().main_hidden_by_app
&& !main
.update(cx, |_, window, _| platform::window_is_visible(window))
Comment thread
richiemcilroy marked this conversation as resolved.
.unwrap_or(true);
match (finished_studio, behaviour) {
(Some(project_dir), crate::store::PostStudioBehaviour::OpenEditor) => {
open_editor(project_dir, cx)
Expand All @@ -667,6 +690,11 @@ pub fn init(main: WindowHandle<MainWindow>, session: Entity<RecordingSession>, c
park_idle_camera_preview(cx);
crate::menus::schedule_dock_sync(cx);
}
(None, _) if keep_hidden_after_instant => {
tracing::info!("main window kept hidden after the Instant recording");
park_idle_camera_preview(cx);
Comment thread
richiemcilroy marked this conversation as resolved.
crate::menus::schedule_dock_sync(cx);
Comment thread
richiemcilroy marked this conversation as resolved.
}
_ => show_main_window(cx),
}
}
Expand Down Expand Up @@ -870,10 +898,12 @@ pub(crate) fn show_main_window_after_capture_pause(cx: &mut App) {
return;
}
}
tracing::info!("showing the main window");
if crate::store::should_show_onboarding() {
open_onboarding(cx);
return;
}
cx.global_mut::<AppWindows>().main_hidden_by_app = false;
let resume_inputs = RecordingSession::global(cx).read(cx).phase == Phase::Idle;
if resume_inputs {
crate::feeds::Feeds::global(cx).update(cx, |feeds, cx| feeds.resume_camera_preview(cx));
Expand Down Expand Up @@ -920,6 +950,7 @@ pub(crate) fn show_main_window_after_capture_pause(cx: &mut App) {
// before the window is visible again.
platform::restore_borderless_style(native);
platform::show_native(native);
tracing::info!("main window shown");
}
// The unit-3 macOS 26 display-link repair, and the reason a window
// hidden before its FIRST paint reshows as nothing at all: AppKit
Expand Down Expand Up @@ -978,6 +1009,7 @@ pub fn heal_main_window_style(cx: &mut App) {

/// `getCurrentWindow().hide()` -- same rule, same reason.
pub fn hide_main_window(cx: &mut App) {
cx.global_mut::<AppWindows>().main_hidden_by_app = true;
let main = cx.global::<AppWindows>().main;
let native = main
.update(cx, |_, window, cx| {
Expand Down Expand Up @@ -2820,6 +2852,7 @@ fn own_windows(cx: &mut App) -> Vec<OwnWindowHandle> {
screenshot_editors,
main_hidden_for_picker: _,
main_visible_before_picker: _,
main_hidden_by_app: _,
editor_hidden_for_picker: _,
camera_park: _,
#[cfg(target_os = "linux")]
Expand Down
8 changes: 8 additions & 0 deletions apps/desktop-gpui/src/i18n/settings_surface_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,14 @@ fn settings_surfaces_match_the_literals_they_replaced() {
tr::settings::shortcuts::outcome::instant_open_link_hint(),
"In your browser",
),
(
tr::settings::shortcuts::outcome::instant_show_cap(),
"Show Cap",
),
(
tr::settings::shortcuts::outcome::instant_show_cap_hint(),
"Back to the recorder",
),
(
tr::settings::shortcuts::outcome::instant_copy_link(),
"Copy link only",
Expand Down
6 changes: 6 additions & 0 deletions apps/desktop-gpui/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,10 @@ pub struct RecordingSession {
/// Taken by the phase observer to honour `postStudioRecordingBehaviour`
/// (`openEditor` by default) the way the Tauri app does.
pub finished_studio: Option<std::path::PathBuf>,
/// An instant recording stopped cleanly and its share link was handed
/// out. Taken by the phase observer, which brings the main window back
/// only for the "Show Cap" Instant outcome.
pub finished_instant: bool,
preparing_studio_editor: Option<PreparingStudioEditor>,
/// `EditorRecordingTarget` (`src-tauri/src/windows.rs:3679-3697`): the
/// open editor project a "Record a new clip" capture must land back in.
Expand Down Expand Up @@ -497,6 +501,7 @@ impl RecordingSession {
controls_open: false,
mic_muted: false,
finished_studio: None,
finished_instant: false,
preparing_studio_editor: None,
editor_recording_target: None,
started_at: None,
Expand Down Expand Up @@ -1378,6 +1383,7 @@ impl RecordingSession {
let separator = if link.contains('?') { '&' } else { '?' };
cx.open_url(&format!("{link}{separator}recordingStopped=1"));
}
this.finished_instant = !low_storage;
cx.write_to_clipboard(gpui::ClipboardItem::new_string(link));
}
}
Expand Down
40 changes: 26 additions & 14 deletions apps/desktop-gpui/src/settings_pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,18 +1023,26 @@ const STUDIO_OUTCOMES: [(store::PostStudioBehaviour, OutcomeOption); 3] = [
),
];

/// `disableAutoOpenLinks`, phrased as what an Instant recording does.
const INSTANT_OUTCOMES: [(bool, OutcomeOption); 2] = [
/// [`store::PostInstantBehaviour`], phrased as what an Instant recording does.
const INSTANT_OUTCOMES: [(store::PostInstantBehaviour, OutcomeOption); 3] = [
(
false,
store::PostInstantBehaviour::OpenLink,
OutcomeOption {
icon: "icons/globe.svg",
label: tr::settings::shortcuts::outcome::instant_open_link,
hint: tr::settings::shortcuts::outcome::instant_open_link_hint,
},
),
(
true,
store::PostInstantBehaviour::ShowCap,
OutcomeOption {
icon: "icons/app-window.svg",
label: tr::settings::shortcuts::outcome::instant_show_cap,
hint: tr::settings::shortcuts::outcome::instant_show_cap_hint,
},
),
(
store::PostInstantBehaviour::CopyLink,
OutcomeOption {
icon: "icons/link.svg",
label: tr::settings::shortcuts::outcome::instant_copy_link,
Expand Down Expand Up @@ -1630,14 +1638,17 @@ impl SettingsWindow {
tr::settings::shortcuts::after_instant::hint(),
&INSTANT_OUTCOMES
.iter()
.map(|(disabled, option)| {
(*option, *disabled == self.settings.disable_auto_open_links)
.map(|(value, option)| {
(*option, *value == self.settings.post_instant_behaviour())
})
.collect::<Vec<_>>(),
|this, index, cx| {
if let Some((disabled, _)) = INSTANT_OUTCOMES.get(index) {
this.settings.disable_auto_open_links = *disabled;
this.write_bool("disableAutoOpenLinks", *disabled, cx);
if let Some((value, _)) = INSTANT_OUTCOMES.get(index) {
let (disable_open, show_main) = value.store_values();
this.settings.disable_auto_open_links = disable_open;
this.settings.show_main_window_after_instant = Some(show_main);
this.write_bool("disableAutoOpenLinks", disable_open, cx);
this.write_bool(store::SHOW_MAIN_WINDOW_AFTER_INSTANT_KEY, show_main, cx);
}
},
cx,
Expand Down Expand Up @@ -8547,12 +8558,13 @@ mod tests {
1
);
}
for disabled in [false, true] {
for value in [
store::PostInstantBehaviour::OpenLink,
store::PostInstantBehaviour::ShowCap,
store::PostInstantBehaviour::CopyLink,
] {
assert_eq!(
INSTANT_OUTCOMES
.iter()
.filter(|(v, _)| *v == disabled)
.count(),
INSTANT_OUTCOMES.iter().filter(|(v, _)| *v == value).count(),
1
);
}
Expand Down
Loading
Loading