Fix Claude Code Screenshots on Arch Linux: Auto-Clipboard Copy in 5 Minutes - ai-woes
The Problem
When using Claude Code or Cursor, taking screenshots and feeding them to the agent is essential. However, the default screenshot tool on Arch only saves files to the filesystem, and I couldn’t find any way to copy screenshots directly to the clipboard automatically.
After struggling with Claude for 20 minutes, I finally found a method that works. Follow these steps so you don’t have to waste your time like I did.
The Solution: Flameshot + Custom Keybinding
After trying various approaches including gnome-screenshot
, maim
, grim
, and D-Bus calls, the most reliable solution is to use Flameshot with a custom keybinding that replaces GNOME’s default screenshot behavior.
Step-by-Step Setup
1. Install Flameshot
sudo pacman -S flameshot
2. Test Flameshot
First, verify that Flameshot works with your clipboard:
flameshot gui --clipboard
This should open the selection interface. Take a screenshot and try pasting it somewhere (Ctrl+V) to confirm it works.
3. Replace GNOME’s Default Screenshot Shortcut
Now we’ll disable GNOME’s default Win+Shift+S and replace it with Flameshot:
# Disable the default GNOME screenshot UI
gsettings set org.gnome.shell.keybindings show-screenshot-ui "['']"
# Create a custom keybinding for Flameshot
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name 'Flameshot Screenshot'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command 'flameshot gui --clipboard'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding '<Shift><Super>s'
# Enable the custom keybinding
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']"
4. Test Your Setup
Press Win+Shift+S and take a screenshot. It should now:
- Open Flameshot’s selection interface
- Automatically copy the screenshot to clipboard
- Allow you to paste anywhere with Ctrl+V
Optional: Save Files AND Copy to Clipboard
If you want to save screenshot files in addition to copying to clipboard, create this script:
# Create a screenshots directory and script
mkdir -p ~/bin ~/Pictures/Screenshots
cat > ~/bin/screenshot-both.sh << 'EOF'
#!/bin/bash
SCREENSHOT_DIR="$HOME/Pictures/Screenshots"
mkdir -p "$SCREENSHOT_DIR"
# Use flameshot to save file AND copy to clipboard
flameshot gui --path "$SCREENSHOT_DIR" --clipboard
EOF
chmod +x ~/bin/screenshot-both.sh
Then update your keybinding to use the script:
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command "$HOME/bin/screenshot-both.sh"
What Each Command Does
show-screenshot-ui "['']"
- Disables GNOME’s default screenshot interfacecustom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/
- Creates a new custom shortcut'<Shift><Super>s'
- Sets the keybinding to Win+Shift+S (Super = Windows key)flameshot gui --clipboard
- Opens Flameshot’s interface and copies result to clipboard--path "$SCREENSHOT_DIR"
- Saves files to a specific directory
Conclusion
With this setup, your Arch Linux GNOME system now behaves like Windows or macOS - press Win+Shift+S
, select an area, and the screenshot is automatically copied to your clipboard for quick pasting. No more manually copying files or using multiple tools!