#!/bin/bash # A simple wrapper around maim # # When run, the screenshot will be added to the clipboard # The file path will be put in the primary selection # Will create notification containing file path # # If you have a project specified, it will put the sceenshot in that folder instead of /tmp path='/tmp' command -v maim > /dev/null && screenshooter="maim" || ( echo -n "You need to install maim\nhttps://github.com/naelstrof/maim" && exit 1 ) #If a project is set we will put screenshots in the project's folder command -v project > /dev/null && project=$(project current --path) if [ -n "$project" ]; then path="$project/screenshots" #Make the directory if it doesn't exist mkdir "$path" 2> /dev/null fi filename="$(date +"%Y-%m-%dT%H-%M-%SZ").png" file="${path}/${filename}" case $1 in "window") maim -i $(xdotool getactivewindow) "$file" ;; "select") #maim -s -r crosshair "$file" maim -s -c 0.41,0.62,0.42,0.2 -l -u "$file" ;; *) maim "$file" ;; esac # Copies the image to your clipboard (ctrl + v) xclip -selection clipboard -target image/png -i "$file" # Copies the filename to primary selection (shift + insert or middle mouse) echo -n "$file" | xclip -selection primary # Creates notification with file name command -v notify-send > /dev/null && notify-send "New Screenshot" "$file"