Skip to content

Instantly share code, notes, and snippets.

@Not-Dhanraj
Last active November 22, 2025 20:10
Show Gist options
  • Select an option

  • Save Not-Dhanraj/a5f21eee0cc9f102df45aba9a5725d70 to your computer and use it in GitHub Desktop.

Select an option

Save Not-Dhanraj/a5f21eee0cc9f102df45aba9a5725d70 to your computer and use it in GitHub Desktop.
GNOME Wayland screenshot solution - save file + copy to clipboard (area screenshot and screenshot without Enter)

GNOME Wayland Screenshot: Save File + Copy to Clipboard

A solution for taking area screenshots on Fedora GNOME (Wayland) that both saves the file AND copies it to clipboard with a single keyboard shortcut.

Problem

  • gnome-screenshot -c flag is broken on Wayland
  • grim + slurp don't work with GNOME's compositor (zwlr_layer_shell_v1 not supported)

Solution

Step 1: Install Dependencies

sudo dnf install -y wl-clipboard gnome-screenshot

Step 2: Create Screenshot Script

Create the script file:

mkdir -p ~/.local/bin
nano ~/.local/bin/screenshot-area.sh

Add this content:

#!/bin/bash
FILE=~/Pictures/Screenshots/$(date +%Y-%m-%d_%H-%M-%S).png
gnome-screenshot -af "$FILE" && wl-copy < "$FILE"

Make it executable:

chmod +x ~/.local/bin/screenshot-area.sh

Step 3: Add Keyboard Shortcut

  1. Open SettingsKeyboardView and Customize Shortcuts
  2. Scroll down and click "Add Custom Shortcut"
  3. Fill in:
    • Name: Screenshot Area (Save + Clipboard)
    • Command: /home/YOUR_USERNAME/.local/bin/screenshot-area.sh (replace YOUR_USERNAME)
    • Shortcut: Press your desired key combo (e.g., Shift + Print)

Step 4: Use It!

Press your shortcut key, select the area, and the screenshot will be:

  • ✅ Saved to ~/Pictures/Screenshots/ with timestamp
  • ✅ Copied to clipboard ready to paste

How It Works

  • gnome-screenshot -af "$FILE" - Takes area screenshot and saves to file without dialog
  • wl-copy < "$FILE" - Copies the saved file to Wayland clipboard
  • && - Only copies if screenshot succeeds

Tested On

  • Fedora 43
  • GNOME 49
  • Wayland
@faizul726
Copy link

Thanks

@Not-Dhanraj
Copy link
Author

Thanks

Happy to help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment