feat: Save 'show hidden files' toggle state to settings

This commit is contained in:
TomZz
2026-06-12 20:25:29 +08:00
parent aca03c924f
commit 690d7418f4
2 changed files with 13 additions and 1 deletions
+10
View File
@@ -125,6 +125,8 @@ pub struct ConfigFile {
pub body_panels: Option<Vec<f32>>,
#[serde(default)]
pub transfers: Vec<crate::terminal::Transfer>,
#[serde(default)]
pub show_hidden_files: bool,
}
fn default_locale() -> String {
@@ -331,6 +333,14 @@ impl ConfigStore {
self.cache.terminal_font_family = family.to_string();
}
pub fn show_hidden_files(&self) -> bool {
self.cache.show_hidden_files
}
pub fn set_show_hidden_files(&mut self, val: bool) {
self.cache.show_hidden_files = val;
}
pub fn get(&self, id: &str) -> Option<&Session> {
self.cache.sessions.iter().find(|s| s.id == id)
}
+3 -1
View File
@@ -338,7 +338,7 @@ impl Ashell {
sftp_creating_folder: false,
sftp_new_folder_input,
sftp_delete_scroll_handle: gpui::ScrollHandle::new(),
show_hidden_files: false,
show_hidden_files: config.show_hidden_files(),
transfers: config.transfers(),
show_transfers_dialog: false,
system_status: None,
@@ -3554,6 +3554,8 @@ impl Ashell {
.tab_stop(false)
.on_click(cx.listener(|this, checked, _, cx| {
this.show_hidden_files = *checked;
this.config.set_show_hidden_files(*checked);
let _ = this.config.save();
cx.notify();
})),
)