Skip to content
Open
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
4 changes: 4 additions & 0 deletions apps/desktop-gpui/locales/de.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ label = "Dock-Symbol immer anzeigen"
description = "Mitteilungen für Kopien in die Zwischenablage, gespeicherte Dateien und mehr anzeigen. Eventuell müssen Sie Cap in den Mitteilungseinstellungen Ihres Systems erlauben."
label = "Systemmitteilungen"

[settings.general.app.open_file]
description = "Legen Sie fest, ob „Datei öffnen“ einen Export öffnet oder im Ordner anzeigt."
label = "Schaltfläche „Datei öffnen“"

[settings.general.recording]
description = "Verhalten während und nach der Aufnahme."
title = "Aufnahme"
Expand Down
4 changes: 4 additions & 0 deletions apps/desktop-gpui/locales/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ label = "Always show dock icon"
description = "Show notifications for clipboard copies, saved files, and more. You may need to allow Cap in your system's notification settings."
label = "System notifications"

[settings.general.app.open_file]
description = "Choose whether Open File opens an export or shows it in its folder."
label = "Open File button"

[settings.general.recording]
description = "Behaviour while you record and after you stop."
title = "Recording"
Expand Down
4 changes: 4 additions & 0 deletions apps/desktop-gpui/locales/es.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ label = "Mostrar siempre el icono en el Dock"
description = "Muestra notificaciones al copiar al portapapeles, guardar archivos y más. Puede que tengas que permitir Cap en los ajustes de notificaciones del sistema."
label = "Notificaciones del sistema"

[settings.general.app.open_file]
description = "Elige si «Abrir archivo» abre una exportación o la muestra en su carpeta."
label = "Botón «Abrir archivo»"

[settings.general.recording]
description = "Comportamiento durante la grabación y al detenerla."
title = "Grabación"
Expand Down
4 changes: 4 additions & 0 deletions apps/desktop-gpui/locales/fr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ label = "Toujours afficher l'icône dans le Dock"
description = "Afficher des notifications pour les copies dans le presse-papiers, les fichiers enregistrés, etc. Vous devrez peut-être autoriser Cap dans les réglages de notifications de votre système."
label = "Notifications système"

[settings.general.app.open_file]
description = "Choisissez si « Ouvrir le fichier » ouvre un export ou l'affiche dans son dossier."
label = "Bouton « Ouvrir le fichier »"

[settings.general.recording]
description = "Comportement pendant l'enregistrement et après l'arrêt."
title = "Enregistrement"
Expand Down
4 changes: 4 additions & 0 deletions apps/desktop-gpui/locales/hi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ label = "Dock आइकन हमेशा दिखाएँ"
description = "क्लिपबोर्ड पर कॉपी करने, फ़ाइलें सहेजने और अन्य कामों के लिए सूचनाएँ दिखाएँ। आपको अपने सिस्टम की सूचना सेटिंग्स में Cap को अनुमति देनी पड़ सकती है।"
label = "सिस्टम सूचनाएँ"

[settings.general.app.open_file]
description = "चुनें कि फ़ाइल खोलें बटन एक्सपोर्ट को खोले या उसे उसके फ़ोल्डर में दिखाए।"
label = "फ़ाइल खोलें बटन"

[settings.general.recording]
description = "रिकॉर्ड करते समय और रोकने के बाद का व्यवहार।"
title = "रिकॉर्डिंग"
Expand Down
4 changes: 4 additions & 0 deletions apps/desktop-gpui/locales/ja.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ label = "Dockアイコンを常に表示"
description = "クリップボードへのコピーやファイルの保存などを通知します。システムの通知設定でCapを許可する必要がある場合があります。"
label = "システム通知"

[settings.general.app.open_file]
description = "「ファイルを開く」で書き出したファイルを開くか、フォルダ内に表示するかを選びます。"
label = "「ファイルを開く」ボタン"

[settings.general.recording]
description = "録画中と録画停止後の動作。"
title = "録画"
Expand Down
4 changes: 4 additions & 0 deletions apps/desktop-gpui/locales/zh-CN.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ label = "始终显示程序坞图标"
description = "在拷贝到剪贴板、保存文件等操作后显示通知。你可能需要在系统的通知设置中允许 Cap。"
label = "系统通知"

[settings.general.app.open_file]
description = "选择“打开文件”是打开导出的文件,还是在所在文件夹中显示它。"
label = "“打开文件”按钮"

[settings.general.recording]
description = "录制期间及停止录制后的行为。"
title = "录制"
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop-gpui/src/editor_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2643,7 +2643,7 @@ impl EditorWindow {
.label("Open File")
.on_click(move |_, _, _| {
if let Some(path) = &path {
library::open_path(path);
library::open_output(path);
}
}),
)
Expand Down
8 changes: 8 additions & 0 deletions apps/desktop-gpui/src/i18n/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ fn english_matches_the_literals_it_replaced() {
tr::settings::general::app::notifications::label(),
"System notifications".into(),
),
(
tr::settings::general::app::open_file::description(),
"Choose whether Open File opens an export or shows it in its folder.".into(),
),
(
tr::settings::general::app::open_file::label(),
"Open File button".into(),
),
(
tr::settings::general::recording::description(),
"Behaviour while you record and after you stop.".into(),
Expand Down
7 changes: 7 additions & 0 deletions apps/desktop-gpui/src/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,13 @@ pub fn open_path(path: &Path) {
}
}

pub fn open_output(path: &Path) {
match crate::store::GeneralSettings::load().open_file_behaviour {
crate::store::OpenFileBehaviour::OpenFile => open_path(path),
crate::store::OpenFileBehaviour::ShowInFolder => reveal_in_folder(path),
}
}

pub fn reveal_in_folder(path: &Path) {
let result = {
#[cfg(target_os = "macos")]
Expand Down
14 changes: 14 additions & 0 deletions apps/desktop-gpui/src/settings_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3317,6 +3317,20 @@ impl SettingsWindow {
)
.into_any_element(),
),
self.setting_row(
tr::settings::general::app::open_file::label(),
Some(tr::settings::general::app::open_file::description()),
self.segmented(
"open-file-behaviour",
self.settings.open_file_behaviour,
cx,
|this, value, cx| {
this.settings.open_file_behaviour = value;
this.write_enum("openFileBehaviour", value, cx);
},
)
.into_any_element(),
),
])
.into_any_element(),
],
Expand Down
48 changes: 48 additions & 0 deletions apps/desktop-gpui/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,14 @@ settings_enum! {
default = System
}

settings_enum! {
OpenFileBehaviour {
OpenFile = "openFile", "Open the file";
ShowInFolder = "showInFolder", "Show in folder";
Comment on lines +768 to +769

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Choices stay in English

OpenFileBehaviour supplies English labels, and segmented displays them directly. When users select another language, the row title and description translate, but “Open the file” and “Show in folder” do not. Users still need to read English to distinguish the choices. Add translated labels for both.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/store.rs
Line: 768-769

Comment:
**Choices stay in English**

`OpenFileBehaviour` supplies English labels, and `segmented` displays them directly. When users select another language, the row title and description translate, but “Open the file” and “Show in folder” do not. Users still need to read English to distinguish the choices. Add translated labels for both.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

}
default = OpenFile
}

settings_enum! {
/// `StudioRecordingQuality`, whose Rust default is `balanced`.
StudioQuality {
Expand Down Expand Up @@ -999,6 +1007,7 @@ pub const DEFAULT_PROJECT_NAME_TEMPLATE: &str = "{target_name} ({target_kind}) {
#[derive(Debug, Clone, PartialEq)]
pub struct GeneralSettings {
pub theme: AppTheme,
pub open_file_behaviour: OpenFileBehaviour,
/// `uiLanguage`: absent, `"system"`, or a catalog code such as `"fr"`. A
/// GPUI-only key; the Tauri app keeps it as an unknown field.
pub ui_language: Option<String>,
Expand Down Expand Up @@ -1332,6 +1341,7 @@ impl GeneralSettings {
) -> Self {
Self {
theme: enum_at(general, "theme"),
open_file_behaviour: enum_at(general, "openFileBehaviour"),
ui_language: opt_string_at(general, crate::i18n::SETTING_KEY),
hide_dock_icon: bool_at(general, "hideDockIcon", false),
enable_notifications: bool_at(general, "enableNotifications", true),
Expand Down Expand Up @@ -3190,4 +3200,42 @@ mod tests {
let cleared = GeneralSettings::from_sections(&general, &Map::new(), &Map::new());
assert!(cleared.excluded_windows.is_empty());
}

#[test]
fn open_file_behaviour_defaults_for_old_settings() {
let general = serde_json::from_str(r#"{"theme":"dark","maxFps":30}"#).unwrap();
let settings = GeneralSettings::from_sections(&general, &Map::new(), &Map::new());
assert_eq!(settings.open_file_behaviour, OpenFileBehaviour::OpenFile);
assert_eq!(settings.theme, AppTheme::Dark);
assert_eq!(
GeneralSettings::default().open_file_behaviour,
OpenFileBehaviour::OpenFile
);
}

#[test]
fn open_file_behaviour_persists_across_store_reloads() {
let store = TempStore::new(
"open-file-behaviour",
Some(r#"{"general_settings":{"theme":"dark"}}"#),
);
assert_eq!(
GeneralSettings::load().open_file_behaviour,
OpenFileBehaviour::OpenFile
);
for (behaviour, json) in [
(OpenFileBehaviour::ShowInFolder, "showInFolder"),
(OpenFileBehaviour::OpenFile, "openFile"),
] {
assert_eq!(behaviour.as_json(), json);
assert!(set_store_setting(
GENERAL_SETTINGS,
"openFileBehaviour",
Value::String(behaviour.as_json().into())
));
assert_eq!(store.read()[GENERAL_SETTINGS]["openFileBehaviour"], json);
assert_eq!(GeneralSettings::load().open_file_behaviour, behaviour);
assert_eq!(GeneralSettings::load().theme, AppTheme::Dark);
}
}
}
Loading