Skip to content

Commit

Permalink
Update documentation with changes in freeze-feat (#116)
Browse files Browse the repository at this point in the history
* [docs] update manpage (1) with changes in freeze-feat

* [fix] make arguments to slurp optional

* [docs] update manpage(7) with cli changes

* [docs] update README with new cli
  • Loading branch information
CheerfulPianissimo authored Aug 25, 2024
1 parent 1c3c802 commit 5c3e220
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 38 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ NOTE: Read `man 7 wayshot` for more examples.

NOTE: Read `man wayshot` for flag information.

Region Selection:
Screenshot and Crop Region:

```bash
wayshot -s "$(slurp)"
wayshot -s
```

Fullscreen:
Expand All @@ -38,13 +38,13 @@ wayshot
Screenshot and copy to clipboard:

```bash
wayshot --stdout | wl-copy
wayshot --clipboard
```

Pick a hex color code, using ImageMagick:

```bash
wayshot -s "$(slurp -p)" --stdout | convert - -format '%[pixel:p{0,0}]' txt:-|grep -E "#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})" -o
wayshot -s - | convert - -format '%[pixel:p{0,0}]' txt:-|grep -E "#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})" -o
```

# Installation
Expand Down
59 changes: 36 additions & 23 deletions docs/wayshot.1.scd
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,70 @@ Wayshot - Screenshot tool for compositors implementing zwlr_screencopy_v1 such a

# SYNOPSIS

*wayshot* [_options_]
*wayshot* [_options_] [_output_]

# ARGUMENTS

*output*,
Location to send captured screenshot to, it can be of the following types:
1. A directory, image outputs will be saved in the default format "wayshot-yyyy-mm-dd-hh-mm-ss.png"

2. A path (Encoding is automatically inferred from the extension).

3. '-' which sends the screenshot to stdout.

The *--clipboard* option can also be used simultaneously with any of the above to copy the image to the clipboard too.

# OPTIONS

*-h*, *--help*
Print help message and quit.
*-h*,
Print concise help messages and quit.

*--help*,
Print full help message and quit.

*-V*, *--version*
Print version information.

*-d*, *--debug*
Enable debug mode.
*--log-level <LOG_LEVEL>*
Log level to be used for printing to stderr
Possible values: trace, debug, info, warn, error

Default value: info

*-c*, *--cursor*
Enable cursor visibility in screenshots.

*--clipboard*
Copy image contents to clipboard.
Copy image contents to clipboard also.
Using this flag will cause the wayshot process to fork and persist in the background offering the image
on the wayland clipboard until some other program overwrites the clipboard.

*-e*, *--extension*
Set the image encoder.
Set the image encoder. Without this option, encoding is either inferred from the *output* filename or defaults to png.
Valid arguments:
- jpeg
- jpg
- png (Default encoder)
- ppm
- qoi
- webp

*-f*, *--file*
Set a custom file path. The default path is `./{current_unix_timestamp}-wayshot.{encoder}`
eg: 1659034753-wayshot.png

*-l*, *--listoutputs*
*-l*, *--list-outputs*
List all valid output names. This flag is generally used in combination with *-o* flag.

*--chooseoutput*
*--choose-output*
Present a fuzzy selector for display (wl_output) selection.

*-o*, *--output*
Choose a particular display (wl_output) to screenshot.

*-s*, *--slurp* <GEOMETRY>
Choose a portion of your display to screenshot using the slurp program.
https://github.com/emersion/slurp . Valid arguments have the form
"%x %y %w %h" or "%x,%y %wx%h", where for example "%w" is an integer giving
the width of the region.

*--stdout*
Emit image data to stdout. The following flag is helpful to pipe image data
to other programs.
*-s*, *--slurp*=<SLURP_ARGS>
If this option is passed, wayshot takes a screenshot first and then uses the *slurp* program to select a portion of that screenshot
https://github.com/emersion/slurp . SLURP_ARGS are any arguments that need to be passed to *slurp*, see *slurp(1)* for more information.

Example:
*wayshot -s="-b 11223377"*
- This takes a screenshot then calls slurp with "-b 11223377" as an argument for cropping the screenshot.

# SEE ALSO
- wayshot(7)
Expand Down
16 changes: 8 additions & 8 deletions docs/wayshot.7.scd
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ Wayshot - Screenshot tool for compositors implementing zwlr_screencopy_v1 such a

# SYNOPSIS

*wayshot* [_options_]
*wayshot* [_options_] [_output_]

# REGION SELECTION
wayshot -s "$(slurp)"
wayshot -s

# FULLSCREEN
# CAPTURE FULLSCREEN

wayshot

# CUSTOM FILE PATH AND EXTENSION

wayshot -f ../screenshot.png --extension ppm
wayshot ../screenshot.png --extension ppm

# SCREENSHOT AND COPY TO CLIPBOARD

wayshot --stdout -e jpeg | wl-copy
wayshot --clipboard

# SCREENSHOT A PARTICULAR DISPLAY

Expand All @@ -30,15 +30,15 @@ wayshot -o eDP-1

# PICK A HEX COLOR CODE, USING IMAGEMAGICk

wayshot -s "$(slurp)" --stdout | convert - -format '%[pixel:p{0,0}]' txt:-|grep -E "#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})" -o
wayshot -s - | convert - -format '%[pixel:p{0,0}]' txt:-|grep -E "#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})" -o

# PICK A HEX COLOR CODE WITHOUT USING IMAGEMAGICK

wayshot -s "$(slurp -p)" --stdout -e ppm | tail -c 3 | od -An -tuC | xargs printf '#%02X%02X%02X\n'
wayshot -s - --encoding ppm | tail -c 3 | od -An -tuC | xargs printf '#%02X%02X%02X\n'

# PICK A COLOR, USING IMAGEMAGICK

wayshot -s "$(slurp -p)" --stdout | convert - -format '%[pixel:p{0,0}]' txt:-
wayshot -s - | convert - -format '%[pixel:p{0,0}]' txt:-

# AUTHORS

Expand Down
2 changes: 1 addition & 1 deletion wayshot/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub struct Cli {

/// Arguments to call slurp with for selecting a region
#[arg(short, long, value_name = "SLURP_ARGS")]
pub slurp: Option<String>,
pub slurp: Option<Option<String>>,

/// Enable cursor in screenshots
#[arg(short, long)]
Expand Down
4 changes: 2 additions & 2 deletions wayshot/src/wayshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ fn main() -> Result<()> {
return Ok(());
}

let image_buffer = if let Some(slurp_region) = cli.slurp {
let slurp_region = slurp_region.clone();
let image_buffer = if let Some(slurp_args) = cli.slurp {
let slurp_region = slurp_args.unwrap_or("".to_string());
wayshot_conn.screenshot_freeze(
Box::new(move || {
|| -> Result<LogicalRegion> {
Expand Down

0 comments on commit 5c3e220

Please sign in to comment.