Skip to content

Commit

Permalink
Merge pull request #38 from gabm/configuration
Browse files Browse the repository at this point in the history
introduce configuration file
  • Loading branch information
gabm authored Feb 13, 2024
2 parents 9fa858b + 1cb63e6 commit f5e8a91
Show file tree
Hide file tree
Showing 15 changed files with 828 additions and 168 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
13 changes: 6 additions & 7 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
"version": "2.0.0",
"tasks": [
{
"type": "cargo",
"command": "run",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--",
"--filename",
//"/home/gabm/Pictures/Screenshots/swappy-20230921-054340.png",
//"/home/gabm/Pictures/Wallpaper/torres_1.jpg",
"/home/gabm/Pictures/Screenshots/satty-20231116-10:35:51.png",
"/home/gabm/Pictures/Screenshots/satty-20240109-22:19:08.png",
//"--fullscreen",
"--output-filename",
"/tmp/out.png",
//"--output-filename",
//"/tmp/out.png",
"--copy-command",
"wl-copy",
],
Expand Down
142 changes: 142 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "satty"
version = "0.8.3"
edition = "2021"
authors = ["Matthias Gabriel <[email protected]>"]
description = "A screenshot annotation tool inspired by Swappy and Flameshot."
description = "Modern Screenshot Annotation. A Screenshot Annotation Tool inspired by Swappy and Flameshot."
homepage = "https://github.com/gabm/satty"
repository = "https://github.com/gabm/satty"
license = "MPL-2.0"
Expand All @@ -25,10 +25,19 @@ gdk-pixbuf = "0.17.2"

# error handling
anyhow = "1.0"
thiserror = "1.0"

# command line
clap = { version = "4.4.10", features = ["derive"] }

# configuration file
xdg = "^2.5"
toml = "0.8.8"
serde = "1.0"
serde_derive = "1.0"
hex_color = {version = "3", features = ["serde"]}
chrono = "0.4.31"


[dependencies.relm4-icons]
version = "0.6.0"
Expand Down
43 changes: 38 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,60 @@ You can download a prebuilt binary for x86-64 on the [Satty Releases](https://gi

Start by providing a filename or a screenshot via stdin and annotate using the available tools. Save to clipboard or file when finished. Tools and Interface have been kept simple.

All configuration is done via the command line interface:
All configuration is done either at the config file in `XDG_CONFIG_DIR/.config/satty/config.toml` or via the command line interface. In case both are specified, the command line options always override the configuration file.

### Configuration File

```toml
[general]
# Start Satty in fullscreen mode
fullscreen = true
# Exit directly after copy/save action
early-exit = true
# Select the tool on startup [possible values: pointer, crop, line, arrow, rectangle, text, marker, blur, brush]
initial-tool = "brush"
# Configure the command to be called on copy, for example `wl-copy`
copy-command = "wl-copy"
# Increase or decrease the size of the annotations
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"

# custom colours for the colour palette
[color-palette]
first= "#00ffff"
second= "#a52a2a"
third= "#dc143c"
fourth= "#ff1493"
fifth= "#ffd700"
custom= "#008000"
```

### Command Line

```sh
» satty --help
A screenshot annotation tool inspired by Swappy and Flameshot.
Modern Screenshot Annotation. A Screenshot Annotation Tool inspired by Swappy and Flameshot.

Usage: satty [OPTIONS] --filename <FILENAME>

Options:
-c, --config <CONFIG>
Path to the config file. Otherwise will be read from XDG_CONFIG_DIR/satty/config.toml
-f, --filename <FILENAME>
Path to input image or '-' to read from stdin
--fullscreen
Start Satty in fullscreen mode
--output-filename <OUTPUT_FILENAME>
Filename to use for saving action, omit to disable saving to file
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
--early-exit
Exit directly after copy/save action
--init-tool <TOOL>
Select the tool on startup [default: pointer] [possible values: pointer, crop, line, arrow, rectangle, text, marker, blur, brush]
--initial-tool <TOOL>
Select the tool on startup [aliases: init-tool] [possible values: pointer, crop, line, arrow, rectangle, text, marker, blur, brush]
--copy-command <COPY_COMMAND>
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
-h, --help
Print help
-V, --version
Expand Down
22 changes: 22 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[general]
# Start Satty in fullscreen mode
fullscreen = true
# Exit directly after copy/save action
early-exit = true
# Select the tool on startup [possible values: pointer, crop, line, arrow, rectangle, text, marker, blur, brush]
initial-tool = "brush"
# Configure the command to be called on copy, for example `wl-copy`
copy-command = "wl-copy"
# Increase or decrease the size of the annotations
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"

# custom colours for the colour palette
[color-palette]
first= "#00ffff"
second= "#a52a2a"
third= "#dc143c"
fourth= "#ff1493"
fifth= "#ffd700"
custom= "#008000"
Loading

0 comments on commit f5e8a91

Please sign in to comment.