.github/workflows | ||
.vscode | ||
docs/images | ||
include | ||
protocol | ||
res | ||
src | ||
.clang-format | ||
.gitignore | ||
LICENSE | ||
meson_options.txt | ||
meson.build | ||
README.md | ||
swappy.1.scd |
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 (will probably have some issues).
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 Brusht
: Switch to Textr
: Switch to Rectangleo
: Switch to Ellipsea
: Switch to Arrow
R
: Use Red ColorG
: Use Green ColorB
: Use Blue ColorC
: Use Custom ColorMinus
: Reduce Stroke SizePlus
: Increase Stroke SizeEqual
: Reset Stroke Sizek
: Clear Paints (cannot be undone)
Ctrl+z
: UndoCtrl+Shift+z
orCtrl+y
: RedoCtrl+s
: Save to file (see man page)Ctrl+c
: Copy to clipboardEscape
orq
: 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
- wayland-protocols
- cairo
- gtk
Optional dependencies:
- libnotify
Then run:
meson build
ninja -C build
Contributing
Pull requests are welcome.
License
MIT