Skip to content

Commit

Permalink
better naming and description
Browse files Browse the repository at this point in the history
  • Loading branch information
FUFSoB committed Feb 16, 2024
1 parent e94ae91 commit b888ab8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ copy-command = "wl-copy"
annotation-size-factor = 2
# Filename to use for saving action. Omit to disable saving to file. Might contain format specifiers: https://docs.rs/chrono/latest/chrono/format/strftime/index.html
output-filename = "/tmp/test-%Y-%m-%d_%H:%M:%S.png"
# Also save screenshot to a file after copy action
save-on-copy = false
# After copying the screenshot, save it to a file as well
save-after-copy = false

# custom colours for the colour palette
[color-palette]
Expand Down Expand Up @@ -107,8 +107,8 @@ Options:
Configure the command to be called on copy, for example `wl-copy`
--annotation-size-factor <ANNOTATION_SIZE_FACTOR>
Increase or decrease the size of the annotations
--save-on-copy
Also save screenshot to a file after copy action
--save-after-copy
After copying the screenshot, save it to a file as well
-h, --help
Print help
-V, --version
Expand Down
4 changes: 2 additions & 2 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ copy-command = "wl-copy"
annotation-size-factor = 2
# Filename to use for saving action. Omit to disable saving to file. Might contain format specifiers: https://docs.rs/chrono/latest/chrono/format/strftime/index.html
output-filename = "/tmp/test-%Y-%m-%d_%H:%M:%S.png"
# Also save screenshot to a file after copy action
save-on-copy = false
# After copying the screenshot, save it to a file as well
save-after-copy = false

# custom colours for the colour palette
[color-palette]
Expand Down
4 changes: 2 additions & 2 deletions src/command_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ pub struct CommandLine {
#[arg(long)]
pub annotation_size_factor: Option<f64>,

/// Also save screenshot to a file after copy action
/// After copying the screenshot, save it to a file as well
#[arg(long)]
pub save_on_copy: bool,
pub save_after_copy: bool,
}

#[derive(Debug, Clone, Copy, Default, ValueEnum)]
Expand Down
18 changes: 9 additions & 9 deletions src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct Configuration {
initial_tool: Tools,
copy_command: Option<String>,
annotation_size_factor: f64,
save_on_copy: bool,
save_after_copy: bool,
color_palette: ColorPalette,
}

Expand Down Expand Up @@ -139,8 +139,8 @@ impl Configuration {
if let Some(v) = general.annotation_size_factor {
self.annotation_size_factor = v;
}
if let Some(v) = general.save_on_copy {
self.save_on_copy = v;
if let Some(v) = general.save_after_copy {
self.save_after_copy = v;
}
}
fn merge(&mut self, file: Option<ConfigurationFile>, command_line: CommandLine) {
Expand Down Expand Up @@ -176,8 +176,8 @@ impl Configuration {
if let Some(v) = command_line.annotation_size_factor {
self.annotation_size_factor = v;
}
if command_line.save_on_copy {
self.save_on_copy = command_line.save_on_copy;
if command_line.save_after_copy {
self.save_after_copy = command_line.save_after_copy;
}
}

Expand Down Expand Up @@ -209,8 +209,8 @@ impl Configuration {
self.annotation_size_factor
}

pub fn save_on_copy(&self) -> bool {
self.save_on_copy
pub fn save_after_copy(&self) -> bool {
self.save_after_copy
}

pub fn color_palette(&self) -> &ColorPalette {
Expand All @@ -228,7 +228,7 @@ impl Default for Configuration {
initial_tool: Tools::Pointer,
copy_command: None,
annotation_size_factor: 1.0f64,
save_on_copy: false,
save_after_copy: false,
color_palette: ColorPalette::default(),
}
}
Expand Down Expand Up @@ -263,7 +263,7 @@ struct ConfiguationFileGeneral {
copy_command: Option<String>,
annotation_size_factor: Option<f64>,
output_filename: Option<String>,
save_on_copy: Option<bool>,
save_after_copy: Option<bool>,
}

#[derive(Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion src/sketch_board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ impl SketchBoard {
"Copied to clipboard.".to_string(),
));

if APP_CONFIG.read().save_on_copy() {
if APP_CONFIG.read().save_after_copy() {
self.handle_save_texture(sender, &texture);
};
},
Expand Down

0 comments on commit b888ab8

Please sign in to comment.