Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- Notifications=1
- ScreenshotSound=1
- CopyToClipboard=1
- ScreenshotSoundEffect=$HOME/Documents/Scripts/Sounds/ScreenshotSound.mp3
- ScreenshotLocation="$HOME/Pictures/Screenshotter"
- Part1() {
- WinName=$(xprop -id $(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2) | grep WM_CLASS | awk '{print $4}' | tr -d '"')
- mkdir -p "$ScreenshotLocation/${WinName^}"
- Time=$(date '+%Y-%m-%d_%T')
- PictureName="$ScreenshotLocation/${WinName^}/$(date '+%Y-%m-%d_%T')_${WinName^}"
- }
- Part2() {
- if [ $ScreenshotSound -eq "1" ]; then
- play $ScreenshotSoundEffect
- fi
- if [ $CopyToClipboard -eq "1" ]; then
- xclip -selection clipboard -t image/png "$PictureName"
- Copied="\nCopied to clipboard!"
- fi
- if [ $Notifications -eq "1" ]; then
- notify-send --app-name=Screenshotter "Screenshot of ${WinName^} taken!" "Saved to $HOME/Pictures/Screenshotter$Copied"
- fi
- }
- case "$1" in
- (-w | --window) ## Takes screenshot of the whole window
- Part1
- scrot -u -q 100 "$PictureName"
- Part2
- exit 1
- ;;
- (-s | --select) ## Select area to take screenshot of
- Part1
- scrot -s -q 100 "$PictureName"
- Part2
- exit 1
- ;;
- (-u | --upload) ## Uploads clipboard image to Imgur, using imgur-screenshot: https://github.com/jomo/imgur-screenshot
- echo "not done" ## Use after taking a screenshot to upload if you need a link to an image.
- exit 1
- ;;
- ("")
- echo "Use options; -w for window, -s for select"
- exit 2
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement