From fd74432e0a0667a01e64fcf99c7a31fa1bbd5058 Mon Sep 17 00:00:00 2001 From: "Rene D. Obermueller" Date: Mon, 5 Jan 2026 17:37:35 +0100 Subject: [PATCH] feat!: introduce early-exit-copy flag Closes: #152 This also separates copy action from the existing early-exit flag, which may break existing workflows/configs. --- README.md | 10 +++++++--- cli/src/command_line.rs | 7 ++++++- src/configuration.rs | 13 +++++++++++++ src/sketch_board.rs | 2 +- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 23529b2..ef8394c 100644 --- a/README.md +++ b/README.md @@ -103,9 +103,11 @@ fullscreen = true resize = { mode = "size", width=2000, height=800 } # try to have the window float (0.20.1). This may depend on the compositor. floating-hack = true -# Exit directly after copy/save action. 0.20.1: Does not apply to save as +# Exit directly after copy/save action. 0.20.1: Does not apply to save as, NEXTRELEASE: Does not apply to copy early-exit = true -# Exit directly after save as (0.20.1) +# Exit directly after copy action. (Experimental, NEXTRELEASE) +early-exit-copy = true +# Exit directly after save as (Experimental, 0.20.1) early-exit-save-as = true # Draw corners of rectangles round if the value is greater than 0 (0 disables rounded corners) corner-roundness = 12 @@ -240,7 +242,9 @@ Options: -o, --output-filename Filename to use for saving action or '-' to print to stdout. Omit to disable saving to file. Might contain format specifiers: . Since 0.20.0, can contain tilde (~) for home dir --early-exit - Exit directly after copy/save action. 0.20.1: This does not apply to "save as" + Exit directly after save action. 0.20.1: This does not apply to "save as", NEXTRELEASE: does not apply to "copy" + --early-exit-copy + Experimental (NEXTRELEASE): Exit directly after copy action --early-exit-save-as Experimental (0.20.1): Exit directly after save as --corner-roundness diff --git a/cli/src/command_line.rs b/cli/src/command_line.rs index c16f9a5..c457fbb 100644 --- a/cli/src/command_line.rs +++ b/cli/src/command_line.rs @@ -36,10 +36,15 @@ pub struct CommandLine { #[arg(short, long)] pub output_filename: Option, - /// Exit directly after copy/save action. 0.20.1: This does not apply to "save as". + /// Exit directly after save action. 0.20.1: This does not apply to "save as", NEXTRELEASE: + /// does not apply to "copy" #[arg(long)] pub early_exit: bool, + /// Experimental (NEXTRELEASE): Exit directly after copy action. + #[arg(long)] + pub early_exit_copy: bool, + /// Experimental (0.20.1): Exit directly after save as #[arg(long)] pub early_exit_save_as: bool, diff --git a/src/configuration.rs b/src/configuration.rs index 0a793f8..fcb6736 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -42,6 +42,7 @@ pub struct Configuration { resize: Option, floating_hack: bool, early_exit: bool, + early_exit_copy: bool, early_exit_save_as: bool, corner_roundness: f32, initial_tool: Tools, @@ -280,6 +281,9 @@ impl Configuration { if let Some(v) = general.early_exit { self.early_exit = v; } + if let Some(v) = general.early_exit_copy { + self.early_exit_copy = v; + } if let Some(v) = general.early_exit_save_as { self.early_exit_save_as = v; } @@ -392,6 +396,9 @@ impl Configuration { if command_line.early_exit { self.early_exit = command_line.early_exit; } + if command_line.early_exit_copy { + self.early_exit_copy = command_line.early_exit_copy; + } if command_line.early_exit_save_as { self.early_exit_save_as = command_line.early_exit_save_as; } @@ -484,6 +491,10 @@ impl Configuration { self.early_exit } + pub fn early_exit_copy(&self) -> bool { + self.early_exit_copy + } + pub fn early_exit_save_as(&self) -> bool { self.early_exit_save_as } @@ -609,6 +620,7 @@ impl Default for Configuration { resize: None, floating_hack: false, early_exit: false, + early_exit_copy: false, early_exit_save_as: false, corner_roundness: 12.0, initial_tool: Tools::Pointer, @@ -693,6 +705,7 @@ struct ConfigurationFileGeneral { resize: Option, floating_hack: Option, early_exit: Option, + early_exit_copy: Option, early_exit_save_as: Option, corner_roundness: Option, initial_tool: Option, diff --git a/src/sketch_board.rs b/src/sketch_board.rs index ac83b7b..80ca9aa 100644 --- a/src/sketch_board.rs +++ b/src/sketch_board.rs @@ -300,7 +300,7 @@ impl SketchBoard { Action::SaveToClipboard => { if let Some(ref pix_buf) = pix_buf { self.handle_copy_clipboard(pix_buf); - early_exit = APP_CONFIG.read().early_exit(); + early_exit = APP_CONFIG.read().early_exit_copy(); } } Action::SaveToFile => {