yoda: phase 2 — customizable toolbar (settings toggles per button)
Phase 1 shipped a fixed 6-button toolbar. Phase 2 moves visibility to the config so users pick which buttons appear. Config (config.rs): - new ToolbarItems struct (CosmicConfigEntry) with one bool per button - Config.toolbar: ToolbarItems, default = 'minimal 6' set from phase 1 (new_folder, rename, delete, cut, copy, paste) + 5 extras off (new_file, reload, toggle_show_hidden, open_terminal, location_up) Rendering (view()): - iterate through self.config.toolbar fields in fixed logical order (location → create/edit → clipboard → view toggles) - dividers inserted only between non-empty groups - whole toolbar hidden if every button is off (no empty container) Settings page (settings()): - new 'Toolbar' section with one toggler per button, wired through Message::SetToolbar(ToolbarItems) which persists via config_set! i18n (en + fr): - added 'toolbar' + 'parent-directory' strings - reused existing new-folder / new-file / rename / delete / cut / copy / paste / reload-folder / show-hidden-files / open-in-terminal All actions dispatch through Action::message so keybindings and toolbar share one code path.
This commit is contained in:
parent
8b51af1632
commit
33a5c8ff99
4 changed files with 188 additions and 27 deletions
|
|
@ -172,6 +172,10 @@ pub struct Config {
|
|||
pub show_details: bool,
|
||||
pub show_recents: bool,
|
||||
pub tab: TabConfig,
|
||||
/// Yoda: Dolphin-style quick actions toolbar under the tab bar.
|
||||
/// Each bool toggles one button; order in the UI is fixed (logical
|
||||
/// grouping file-ops then clipboard then view toggles).
|
||||
pub toolbar: ToolbarItems,
|
||||
pub type_to_search: TypeToSearch,
|
||||
}
|
||||
|
||||
|
|
@ -236,11 +240,48 @@ impl Default for Config {
|
|||
show_details: false,
|
||||
show_recents: true,
|
||||
tab: TabConfig::default(),
|
||||
toolbar: ToolbarItems::default(),
|
||||
type_to_search: TypeToSearch::Recursive,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Yoda: visibility toggles for each quick-action toolbar button.
|
||||
/// Default = the original "minimal 6" set (new_folder, rename, delete,
|
||||
/// cut, copy, paste). Other items default to false so users opt in.
|
||||
#[derive(Clone, Copy, CosmicConfigEntry, Debug, Deserialize, Eq, PartialEq, Serialize)]
|
||||
pub struct ToolbarItems {
|
||||
pub new_folder: bool,
|
||||
pub new_file: bool,
|
||||
pub rename: bool,
|
||||
pub delete: bool,
|
||||
pub cut: bool,
|
||||
pub copy: bool,
|
||||
pub paste: bool,
|
||||
pub reload: bool,
|
||||
pub toggle_show_hidden: bool,
|
||||
pub open_terminal: bool,
|
||||
pub location_up: bool,
|
||||
}
|
||||
|
||||
impl Default for ToolbarItems {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
new_folder: true,
|
||||
new_file: false,
|
||||
rename: true,
|
||||
delete: true,
|
||||
cut: true,
|
||||
copy: true,
|
||||
paste: true,
|
||||
reload: false,
|
||||
toggle_show_hidden: false,
|
||||
open_terminal: false,
|
||||
location_up: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, CosmicConfigEntry, Deserialize, Serialize)]
|
||||
#[serde(default)]
|
||||
pub struct DesktopConfig {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue