* feat(cli): add -v and --version flags * fix(code): typo * fix(code): clang-format src/application.c * docs(swappy.1.scd): add version flags and long names for 'help' and 'file' |
||
---|---|---|
.github/workflows | ||
.vscode | ||
docs/images | ||
example | ||
include | ||
res | ||
src | ||
test/images | ||
.clang-format | ||
.clang-tidy | ||
.gitignore | ||
CHANGELOG.md | ||
LICENSE | ||
meson_options.txt | ||
meson.build | ||
README.md | ||
swappy.1.scd |
swappy
A Wayland native snapshot and editor tool, inspired by Snappy on macOS. Works great with grim, slurp and sway. But can easily work with other screen copy tools that can output a final PNG image to stdout
. See below.
Screenshot
Example usage
Output of grim
(or any tool outputing a PNG file):
grim -g "$(slurp)" - | swappy -f -
Swappshot a PNG file:
swappy -f "~/Desktop/my-gnome-saved-file.png"
Print final surface to stdout (useful to pipe with other tools):
grim -g "$(slurp)" - | swappy -f - -o - | pngquant -
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 -
Config
The config file is located at $XDG_CONFIG_HOME/swappy/config
or at $HOME/.config/swappy/config
.
The file follows the GLib conf
format. See the man
page for details. There is example config file here.
The following lines can be used as swappy's default:
[Default]
save_dir=$HOME/Desktop
show_panel=false
line_size=5
text_size=20
text_font=sans-serif
save_dir
is where swappshots will be saved, can contain env variables and must exist in your filesystemshow_panel
is used to toggle the paint panel on or off upon startupline_size
is the default line size (must be between 1 and 50)text_size
is the default text size (must be between 10 and 50)text_font
is the font used to render text, its format is pango friendly
Keyboard Shortcuts
Ctrl+b
: Toggle Paint Panel
b
: Switch to Brusht
: Switch to Textr
: Switch to Rectangleo
: Switch to Ellipsea
: Switch to Arrowd
: Switch to Blur (d
stands for droplet)
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
orCtrl+w
: Quit swappy
Limitations
- Copy: If you don't have wl-clipboard installed, 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 on wayland backend yet. We need to do it on the Wayland level, or wait for GTK 4. For now, we use
wl-copy
if installed and revert togtk
clipboard if not found. - Fonts: Swappy relies on Font Awesome 5 being present to properly render the icons. On Arch you can simply install those with:
sudo pacman -S otf-font-awesome
Installation
Building from source
Install dependencies (on Arch, name can vary for other distros):
- meson
- ninja
- cairo
- pango
- gtk
- glib2
- scdoc
Optional dependencies:
wl-clipboard
(to make sure the copy is saved if you close swappy)libnotify
(not get notified when swappshot is copied or saved)otf-font-awesome
(to draw the paint icons properly)
Then run:
meson build
ninja -C build
Contributing
Pull requests are welcome.
License
MIT