ランキングに戻る

jtheoof/swappy

C

A Wayland native snapshot editing tool, inspired by Snappy on macOS

waylandsnapshotsnappyswayscreenshotannotation-tool
スター成長
スター
1.5k
フォーク
62
週間成長
Issue
31
5001k
2023年1月2024年3月2025年5月2026年7月
README

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 image to stdout. See below.

Screenshot

Swappy Screenshot

Example usage

Output of grim (or any tool outputting an image 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
save_filename_format=swappy-%Y%m%d-%H%M%S.png
show_panel=false
line_size=5
text_size=20
text_font=sans-serif
paint_mode=brush
early_exit=false
fill_shape=false
auto_save=false
custom_color=rgba(193,125,17,1)
transparent=false
transparency=50
  • save_dir is where swappshots will be saved, can contain env variables, when it does not exist, swappy attempts to create it first, but does not abort if directory creation fails
  • save_filename_format: is the filename template, if it contains a date format, this will be parsed into a timestamp. Format is detailed in strftime(3). If this date format is missing, filename will have no timestamp
  • show_panel is used to toggle the paint panel on or off upon startup
  • line_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
  • paint_mode is the mode activated at application start (must be one of: brush|text|rectangle|ellipse|arrow|blur, matching is case-insensitive)
  • early_exit is used to make the application exit after saving the picture or copying it to the clipboard
  • fill_shape is used to toggle shape filling (for the rectangle and ellipsis tools) on or off upon startup
  • auto_save is used to toggle auto saving of final buffer to save_dir upon exit
  • custom_color is used to set a default value for the custom color
  • transparency is used to set transparency of everything that is drawn during startup
  • transparent is used to toggle transparency during startup

Keyboard Shortcuts

  • Ctrl+b: Toggle Paint Panel

  • b: Switch to Brush
  • e t: Switch to Text (Editor)
  • r s: Switch to Rectangle (Square)
  • c o: Switch to Ellipse (Circle)
  • a: Switch to Arrow
  • d: Switch to Blur (d stands for droplet)

  • 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
  • f: Toggle Shape Filling
  • x k: Clear Paints (cannot be undone)
  • T: Toggle Transparency

  • Ctrl: Center Shape (Rectangle & Ellipse) based on draw start

  • 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 or Ctrl+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 to gtk 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
  • Output Format: Only PNG is supported.

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)
  • otf-font-awesome (to draw the paint icons properly)

Then run:

meson setup build
ninja -C build

i18n

This section is for developers, maintainers and translators.

To add support to a new locale or when translations are updated:

  1. Update src/po/LINGUAS (when new locales are added)
  2. Generate a new po file (ignore and do not commit potential noise in other files):
ninja -C build swappy-update-po

To rebuild the base template (should happen less often):

ninja -C build swappy-pot

See the meson documentation for details.

Contributing

Pull requests are welcome. This project uses conventional commits to automate changelog generation.

Release

We rely on standard-version which is part of the JavaScript ecosystem but works well with any project.

./script/github-release

Make sure everything is valid in the Draft release, then publish the draft.

Release tarballs are signed with this PGP key: F44D05A50F6C9EB5C81BCF966A6B35DBE9442683

License

MIT

関連リポジトリ
rustdesk/rustdesk

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

Rustcrates.ioGNU Affero General Public License v3.0remote-controlremote-desktop
rustdesk.com
118.6k18.1k
hyprwm/Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.

C++BSD 3-Clause "New" or "Revised" Licensewaylandwayland-compositor
hypr.land
37.1k1.9k
niri-wm/niri

A scrollable-tiling Wayland compositor.

Rustcrates.ioGNU General Public License v3.0rustsmithay
niri-wm.github.io/niri/
26.3k995
swaywm/sway

i3-compatible Wayland compositor

CMIT Licensecompositorwayland
swaywm.org
17.1k1.3k
end-4/dots-hyprland

Usability-first dotfiles

QMLGNU General Public License v3.0dotfileslinux
ii.clsty.link
15.2k1.3k
Alexays/Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:

C++MIT Licensewaylandwlroots
11.7k1.1k
caelestia-dots/shell

A fluid, morphing shell for your Linux desktop

QMLGNU General Public License v3.0dotfileshyprland
caelestiashell.com/landing
10.7k748
phw/peek

Simple animated GIF screen recorder with an easy to use interface

ValaGNU General Public License v3.0linuxgif-recorder
10.6k334
H-M-H/Weylus

Use your tablet as graphic tablet/touch screen on your computer.

Rustcrates.ioOthertouch-screenhardware-acceleration
9.4k379
brndnmtthws/conky

Light-weight system monitor for X, Wayland, and other things, too

C++GNU General Public License v3.0conkyimlib2
conky.cc
8.4k663
mmulet/term.everything

Run any GUI app in the terminal❗

GoGo ModulesGNU Affero General Public License v3.0alacrittycli
8k192
AvengeMedia/DankMaterialShell

Desktop shell for wayland compositors built with Quickshell & GO, optimized for niri, hyprland, sway, MangoWC, labwc, and MiracleWM.

QMLMIT Licensequickshelltiling-window-manager
danklinux.com
7.3k454