mirror of
https://github.com/rust-kotlin/ashell.git
synced 2026-09-22 08:01:00 +00:00
feat: Save 'show hidden files' toggle state to settings
This commit is contained in:
@@ -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
@@ -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();
|
||||
})),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user