A Wayland native snapshot editing tool, inspired by Snappy on macOS
Go to file
2020-01-03 23:42:01 -05:00
.github/workflows revert:"chore(ci): run clang format during build" 2020-01-01 14:56:26 -05:00
.vscode chore(vscode): update settings 2020-01-03 23:42:01 -05:00
docs/images docs(readme): update documentation 2019-12-28 19:50:47 -05:00
include refactor(swappy): rename painting into settings 2020-01-01 15:21:36 -05:00
protocol refactor(wayland): make all wayland code optional 2019-12-31 01:25:55 -05:00
res fix(ui): move paint area inside GtkFixed 2019-12-29 12:12:49 -05:00
src refactor(swappy): rename painting into settings 2020-01-01 15:21:36 -05:00
.clang-format works, next is screencopy 2019-11-24 23:07:44 -05:00
.gitignore git: ignore glade backup file 2019-12-17 22:26:35 -05:00
LICENSE Initial commit 2019-11-19 00:21:06 -05:00
meson_options.txt feat: init project 2019-11-19 00:23:34 -05:00
meson.build refactor(wayland): make all wayland code optional 2019-12-31 01:25:55 -05:00
README.md refactor(wayland): make all wayland code optional 2019-12-31 01:25:55 -05:00
swappy.1.scd docs(man): update man page 2019-12-28 21:43:44 -05:00

swappy

A Wayland and X11 native snapshot and editor tool, inspired by Snappy on macOS. Works great with grim, slurp and sway. But can also work for with other screenshot tools if you use the -f option. See below.

Wayland code was largely taken from grim, needs a compositor that implements the wlr-screencopy-unstable-v1.xml protocol.

You can use this tool in two ways, either use it as the output of grim (recommended) or grab the geometry yourself.

Screenshot

Swappy Screenshot

Example usage

Output of grim (or any tool outputing a PNG file):

grim -g "$(slurp)" - | swappy -f -

Swappshot a PNG file (good for compositors not supporting screencopy protocol):

swappy -f "~/Desktop/my-gnome-saved-file.png"

Swappshot a region:

swappy -g "100,100 200x200"

Select a region and swappshot it:

swappy -g "$(slurp)"

Grab a swappshot from a specific window under Sway, using swaymsg and jq:

grim -g "$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp)" - | swappy -f -
# Or
swappy -g "$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp)"

Keyboard Shortcuts

  • Ctrl+b: Toggle Paint Panel

  • b: Switch to Brush
  • t: Switch to Text
  • r: Switch to Rectangle
  • o: Switch to Ellipse
  • a: Switch to Arrow

  • R: Use Red Color
  • G: Use Green Color
  • B: Use Blue Color
  • C: Use Custom Color
  • Minus: Reduce Stroke Size
  • Plus: Increase Stroke Size
  • Equal: Reset Stroke Size
  • k: Clear Paints (cannot be undone)

  • Ctrl+z: Undo
  • Ctrl+Shift+z or Ctrl+y: Redo
  • Ctrl+s: Save to file (see man page)
  • Ctrl+c: Copy to clipboard
  • Escape or q: Quit swappy

Limitations

  • Copy: Copy to clipboard won't work if you close swappy (the content of the clipboard is lost). This because GTK 3.24 has not implemented persistent storage. We need to do it on the Wayland level, or wait for GTK 4. For now, Paste your Swappshot where you want to before you close the app.

Installation

Arch Linux User Repository

Assuming yay as your AUR package manager:

  • stable: yay -S swappy
  • latest: yay -S swappy-git

Building from source

Install dependencies:

  • meson
  • wayland
  • cairo
  • gtk

Optional dependencies:

  • wayland-protocols (for the -g option to work with screencopy protocol).
  • libnotify (not get notified when swappshot is copied or saved).
  • scdoc to generate the man page

Then run:

meson build
ninja -C build

Contributing

Pull requests are welcome.

License

MIT