diff --git a/src/command_line.rs b/src/command_line.rs index 023d957..0143ea5 100644 --- a/src/command_line.rs +++ b/src/command_line.rs @@ -35,6 +35,10 @@ pub struct CommandLine { /// Increase or decrease the size of the annotations #[arg(long)] pub annotation_size_factor: Option, + + /// Hide toolbars by default + #[arg(short, long)] + pub default_hide_toolbars: bool, } #[derive(Debug, Clone, Copy, Default, ValueEnum)] diff --git a/src/configuration.rs b/src/configuration.rs index 978f5d9..3a35b92 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -36,6 +36,7 @@ pub struct Configuration { copy_command: Option, annotation_size_factor: f64, color_palette: ColorPalette, + default_hide_toolbars: bool, } pub struct ColorPalette { @@ -138,6 +139,9 @@ impl Configuration { if let Some(v) = general.annotation_size_factor { self.annotation_size_factor = v; } + if let Some(v) = general.default_hide_toolbars { + self.default_hide_toolbars = v; + } } fn merge(&mut self, file: Option, command_line: CommandLine) { // input_filename is required and needs to be overwritten @@ -160,6 +164,9 @@ impl Configuration { if command_line.early_exit { self.early_exit = command_line.early_exit; } + if command_line.default_hide_toolbars { + self.default_hide_toolbars = command_line.default_hide_toolbars; + } if let Some(v) = command_line.initial_tool { self.initial_tool = v.into(); } @@ -205,6 +212,10 @@ impl Configuration { pub fn color_palette(&self) -> &ColorPalette { &self.color_palette } + + pub fn default_hide_toolbars(&self) -> bool { + self.default_hide_toolbars + } } impl Default for Configuration { @@ -218,6 +229,7 @@ impl Default for Configuration { copy_command: None, annotation_size_factor: 1.0f64, color_palette: ColorPalette::default(), + default_hide_toolbars: false, } } } @@ -251,6 +263,7 @@ struct ConfiguationFileGeneral { copy_command: Option, annotation_size_factor: Option, output_filename: Option, + default_hide_toolbars: Option, } #[derive(Deserialize)] diff --git a/src/main.rs b/src/main.rs index fd3d2ee..5243cd8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -241,6 +241,11 @@ impl Component for App { .launch(()) .forward(sketch_board.sender(), SketchBoardInput::ToolbarEvent); + if APP_CONFIG.read().default_hide_toolbars() { + tools_toolbar.widget().hide(); + style_toolbar.widget().hide(); + } + // Model let model = App { sketch_board,