Suggestion for Snippet to use Satty on Gnome Wayland
Hey Guys,
I have been a happy user of flameshot for years, but I nede to swithc to wayland for compatibility with some XR glasses, which means I can't use flameshot properly anymore.
I found Satty, and figure out how to use it with gnome, here is my snippet
I add a keyshortcut to a script in ~/scripts/screenshot_statty.sh and I have a really good experience with annotations.
#!/bin/bash
set -e
# Create a temporary file and ensure it gets deleted on exit
TMPFILE=$(mktemp --suffix=.png)
trap 'echo "Cleaning up..."; rm -f "$TMPFILE"' EXIT
# Notify user that screenshot selection is starting
notify-send "Screenshot" "Select area to capture..." -t 2000
# Take the initial screenshot
if ! gnome-screenshot -a -f "$TMPFILE"; then
notify-send -u critical "Screenshot Error" "Failed to capture screenshot. Make sure gnome-screenshot is installed."
exit 1
fi
# Check if the screenshot was actually taken (user might have cancelled)
if [ -s "$TMPFILE" ]; then
echo "Screenshot captured, opening with satty for editing..."
# Open with satty for editing
if ! satty --filename "$TMPFILE"; then
notify-send -u critical "Editor Error" "Failed to open satty editor. Make sure satty is installed."
exit 1
fi
# Check if the file still exists and has content after editing
if [ -s "$TMPFILE" ]; then
echo "Copying final image to clipboard..."
# Copy to clipboard
if wl-copy < "$TMPFILE"; then
notify-send "Screenshot Complete" "Edited image copied to clipboard!" -i image-x-generic
else
notify-send -u normal "Screenshot Saved" "Image edited but clipboard copy failed. File saved temporarily." -i image-x-generic
fi
else
notify-send "Screenshot Cancelled" "No image was saved." -t 3000
fi
else
echo "Screenshot cancelled or failed."
notify-send "Screenshot Cancelled" "No area was selected." -t 3000
fi
Anyway, just wanted to give you something for the gnome wayland weirdos, like myself.
Thanks for reading!
thanks for your words and this script.. mind putting it to contrib?
hey @gabm, found not much about contrib, should I do a PR?
please, just make a new folder and put it there!
I got two remarks here. I suppose they could go into the PR, but just so I don't forget I'm posting them here.
I think
satty --filename "$TMPFILE";
doesn't do what the comments suggest unless there is a config file that specifies actions. This doesn't save it anywhere, because the setting for esc is to exit and for right click and enter to do nothing.
Also, since satty can copy to clipboard with enter or escape actions, I'd probably check the clipboard and send positive or negative notification depending on whether the content as per file is png in order to simplify. Satty also sends notification when copying to clipboard, so perhaps that is sufficient even.
Is this snippet still works on GNOME 49?
It relays on gnome-screenshot: https://itsfoss.gitlab.io/post/why-the-old-gnome-screenshot-app-doesnt-work-in-gnome-49/