Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!--

Thanks for your contribution! Please consider CONTRIBUTING.md.

tl;dr:

- we don't squash anything
- to clean up, try: git rebase --interactive HEAD~5
- please make sure all commits compile
- please use conventional commit messages at least for the first commit and PR
- please avoid breaking configuration or disrupting existing user workflows
- in case of potential surprises,
- please add a "!" for attention, e.g. "fix!", "feat!"
- provide a small section that may be included in the release notes.
- if there are conflicts, please rebase your branch onto main rather than merge main into your branch
- git rebase <upstream repository>/main
- if you used LLM/Generative AI help
- please say that you did
- you vouch for the code
- if in doubt, ask us, we're happy to help

-->

<!--

Sorry for removing your commit body by template usage, feel free to add it back.

-->
38 changes: 31 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,36 @@ CONTRIBUTING

Contributions are welcome. Satty is not able to evolve without relying on its contributors and their contributions.

We're always looking for and grateful about help with e.g. documentation/README, PRs, PR reviews, FAQ or other wiki entries.

This documents tries to reduce friction when it comes to contributions by defining some guidelines, some of which may follow a rationale while others are arbitrary determinations.

Please note that opening a PR or even just an issue may expose your work to pertinent discussion regarding code quality, Satty's scope and these guidelines, and possibly things we haven't yet thought of. This isn't meant as discouragement, just as a heads-up.

Issues for bugs or feature requests
--

Bug reports and ideas for Satty are valuable contributions. But please take the time to search for existing issues.

Issue first, then PR
--

The issue should state what is missing from or broken in Satty. All the discussion around whether a feature is in scope, or a behaviour is a bug can take place there. A related PR is then just about correctness of a fix or feature implementation. This ensures that a specific feature or fix is actually wanted.

Commits and PRs
--

- We don't squash the commits in a PR. If you feel that some commits are temporary in nature, please squash them yourself, otherwise they will show up in commit history after we merge the PR.
- If github indicates conflicts, please rebase your branch instead of merging upstream changes. We know that having to rebase sucks, so we're doing our best to point out where conflicts may arise even in advance, but sometimes conflicts are inevitable. We're happy to assist with rebasing, just say the word.
- Please make sure that all commits in a non-draft PR compile, this helps `git bisect`.
- The first commit in a PR and the PR itself should use a conventional commit message.
- PRs should not break existing config or disrupt existing user workflows. But if there are potential surprises, please add a "!" for attention, e.g. "fix!", "feat!", and provide a small section that may be included in the release notes.

Milestones
--

We use these to indicate which issues and/or PRs we'd ideally like to include with the next release. This doesn't mean any pressure, or that there's any deadline.

3rd party crates
--

Expand Down Expand Up @@ -48,12 +69,15 @@ Command line parameters changes

Please include anticipated next version in the comment for command line arguments, especially when adding arguments or options. You can use the placeholder `NEXTRELEASE` in `command_line.rs`, `configuration.rs` and `README.md`.

GenAI usage
LLM/Generative AI usage
--

GenAI usage is tempting and can save time, but it's not without pitfalls. At this point in time, full vibe coding mode can and often does lead to bad quality code which we are not going to merge.

When using GenAI in the context of Satty PRs, please make sure that
- any generated code can actually be licensed under Satty's license, i.e. doesn't violate existing intellectual property
- any generated code actually does what it claims it does
- you have a technical understanding of how the generated code works and you (not the GenAI) can explain it in detail
LLM usage is tempting and can save time, but it's not without pitfalls. Quality of results may depend on the model as well as the prompt, and even then it can go wrong. When using LLM help in the context of
- Satty PRs
- please disclose LLM usage, this can be important for downstream packages as well as for reviewers so they know what to look for
- you vouch for the submitted code, i.e.
- it does what the PR text says it does
- it can be licensed under Satty's license and doesn't violate existing intellectual property
- you have a technical understanding of it
- Satty bug reports
- please make sure the bug actually exists
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ 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
# Change to true to automatically copy to clipboard after every annotation change
auto-copy = false
# Exit directly after copy/save action. 0.20.1: Does not apply to save as
early-exit = true
# Exit directly after save as (0.20.1)
Expand Down Expand Up @@ -253,6 +255,8 @@ Options:
Increase or decrease the size of the annotations
--save-after-copy
After copying the screenshot, save it to a file as well Preferably use the `action_on_copy` option instead
--auto-copy
Automatically copy to clipboard after every annotation change
--actions-on-enter <ACTIONS_ON_ENTER>
Actions to perform when pressing Enter [possible values: save-to-clipboard, save-to-file, save-to-file-as, copy-filepath-to-clipboard, exit]
--actions-on-escape <ACTIONS_ON_ESCAPE>
Expand Down
4 changes: 4 additions & 0 deletions cli/src/command_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ pub struct CommandLine {
#[arg(long)]
pub save_after_copy: bool,

/// Automatically copy to clipboard after every annotation change
#[arg(long)]
pub auto_copy: bool,

/// Actions to perform when pressing Enter
#[arg(long, value_delimiter = ',')]
pub actions_on_enter: Option<Vec<Action>>,
Expand Down
13 changes: 13 additions & 0 deletions src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub struct Configuration {
copy_command: Option<String>,
annotation_size_factor: f32,
save_after_copy: bool,
auto_copy: bool,
actions_on_enter: Vec<Action>,
actions_on_escape: Vec<Action>,
actions_on_right_click: Vec<Action>,
Expand Down Expand Up @@ -301,6 +302,9 @@ impl Configuration {
if let Some(v) = general.save_after_copy {
self.save_after_copy = v;
}
if let Some(v) = general.auto_copy {
self.auto_copy = v;
}
if let Some(v) = general.actions_on_enter {
self.actions_on_enter = v;
}
Expand Down Expand Up @@ -422,6 +426,9 @@ impl Configuration {
if command_line.save_after_copy {
self.save_after_copy = command_line.save_after_copy;
}
if command_line.auto_copy {
self.auto_copy = command_line.auto_copy;
}
if let Some(v) = command_line.actions_on_enter {
self.actions_on_enter = v.iter().cloned().map(Into::into).collect();
}
Expand Down Expand Up @@ -528,6 +535,10 @@ impl Configuration {
self.save_after_copy
}

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

pub fn actions_on_enter(&self) -> Vec<Action> {
self.actions_on_enter.clone()
}
Expand Down Expand Up @@ -615,6 +626,7 @@ impl Default for Configuration {
copy_command: None,
annotation_size_factor: 1.0,
save_after_copy: false,
auto_copy: false,
actions_on_enter: vec![],
actions_on_escape: vec![Action::Exit],
actions_on_right_click: vec![],
Expand Down Expand Up @@ -699,6 +711,7 @@ struct ConfigurationFileGeneral {
copy_command: Option<String>,
annotation_size_factor: Option<f32>,
save_after_copy: Option<bool>,
auto_copy: Option<bool>,
output_filename: Option<String>,
actions_on_enter: Option<Vec<Action>>,
actions_on_escape: Option<Vec<Action>>,
Expand Down
10 changes: 9 additions & 1 deletion src/sketch_board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,9 @@ 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();
if !APP_CONFIG.read().auto_copy() {
early_exit = APP_CONFIG.read().early_exit();
}
}
}
Action::SaveToFile => {
Expand Down Expand Up @@ -687,6 +689,9 @@ impl SketchBoard {

if let ToolUpdateResult::Commit(d) = deactivate_result {
self.renderer.commit(d);
if APP_CONFIG.read().auto_copy() {
self.renderer.request_render(&[Action::SaveToClipboard]);
}
// we handle commit directly and "downgrade" to a simple redraw result
deactivate_result = ToolUpdateResult::Redraw;
}
Expand Down Expand Up @@ -1127,6 +1132,9 @@ impl Component for SketchBoard {
match result {
ToolUpdateResult::Commit(drawable) => {
self.renderer.commit(drawable);
if APP_CONFIG.read().auto_copy() {
self.renderer.request_render(&[Action::SaveToClipboard]);
}
self.refresh_screen();
}
ToolUpdateResult::Unmodified | ToolUpdateResult::StopPropagation => (),
Expand Down
Loading