i3wm-screenshot-tool/i3-screenshot-import.sh
2025-03-06 07:26:45 +01:00

35 lines
961 B
Bash

#!/bin/bash
# i3-screenshot-import.sh - Alternative tool using ImageMagick's import
# This script uses a different approach that might work better on some systems
# Default save location - user's Pictures directory
SAVE_DIR="$HOME/Pictures/Screenshots"
TIMESTAMP=$(date +%Y-%m-%d_%H-%M-%S)
SCREENSHOT_PATH="$SAVE_DIR/screenshot_$TIMESTAMP.png"
# Create the save directory if it doesn't exist
mkdir -p "$SAVE_DIR"
# Function to display notification
notify() {
notify-send "Screenshot Tool" "$1" -i camera-photo
}
# Take a screenshot of selected area using import
notify "Select an area to capture"
import "$SCREENSHOT_PATH"
# Check if screenshot was taken successfully
if [ $? -ne 0 ]; then
notify "Screenshot canceled"
exit 1
fi
# Copy to clipboard
xclip -selection clipboard -t image/png -i "$SCREENSHOT_PATH"
# Notify user
notify "Screenshot saved to $SCREENSHOT_PATH and copied to clipboard"
echo "Screenshot saved to: $SCREENSHOT_PATH"