sway-interactive-screenshot
is Python helper script that enables users to take
screenshots and video captures interactively with Sway.
If you are using Arch Linux, you can install sway-interactive-screenshot with
the
sway-interactive-screenshot
AUR package (e.g. yay -S sway-interactive-screenshot
). You can otherwise download the sway-interactive-screenshot
file, set it as executable and add it to your $PATH
(e.g. putting it into your /usr/bin
)
For the program to work, you will need the following dependencies installed:
- Python 3.7+.
swaywm
.fuzzel
to prompt what you want to take a screenshot of.grim
to take the screenshot.slurp
to select an area on the screen.notify-send
to send a notification to the notification daemon (such asmako
).wl-clipboard
to copy the screenshot to the clipboard.rofi
(optional) to use rofi instead of fuzzelswappy
(optional) to edit the captured screenshot.dragon
(optional) to drag and drop the captured screenshot.xdg-utils
(optional) to open the captured screenshot with the default image viewer.wf-recorder
(optional) to capture videos.tomli
if not using Python 3.11+.
To bind this script to the Print
key, just add this to your ~/.config/sway/config
:
bindsym Print exec /path/to/sway-interactive-screenshot
You can also add this to do video capture:
bindsym Shift+Print exec /path/to/sway-interactive-screenshot --video
You can edit a screenshot that was taken by running the default action on the
notification. With mako
's default
settings, this is done by just clicking on the notification.
sway-interactive-screenshot
can be configured through the ~/.config/sway-interactive-screenshot/config.toml
file. Here's an example:
[screenshot]
# Prompt string to use.
prompt = "📷> "
# Directory in which to save screenshots.
save_dir = "~"
# File name format.
# See: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes
file_name = "screenshot_%Y-%m-%dT%H:%M:%S.png"
# Image format.
type = "png" # "jpeg", "ppm"
# JPEG quality value.
jpeg_quality = 80
# PNG compression level value.
png_level = 6
# Show or hide cursor.
cursor = false
[screencast]
# Prompt string to use.
prompt = "📹> "
# PID file used to keep track of a screencast in progress.
pid_file = "${XDG_RUNTIME_DIR}/sway-interactive-screenshot.${WAYLAND_DISPLAY}.video.pid"
# Directory in which to save screencast.
save_dir = "~"
# File name format.
# See: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes
file_name = "screencast_%Y-%m-%dT%H:%M:%S.mkv"
# Record audio.
audio = "ask" # "yes", "no"
[notification_actions]
# Alternative name for dragon-drop binary
dragon.command = "dragon"
[ask]
command = "fuzzel"
args = []
The SWAY_INTERACTIVE_SCREENSHOT_SAVEDIR
environment variable, while still supported, is deprecated and will be removed in a future version.