Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # This program takes screenshot, saves it into your screenshot folder
- # sends a desktop notification.
- # Made by woox2k & xpander
- # Depends on escrotum, notify-send and xdotool (grabs current window)
- #date function
- DATE=`which date`
- # Screenshot folder location (add / to the end)
- location=$HOME"/Pictures/"
- # File name format. (Just make sure there is some variables that change so screens won't get overwritten)
- filename="ss_`$DATE +%d%m%Y_%H.%M.%S`"
- # Send notification after file checking
- NotifyAction(){
- if ls -f "$location""$filename".png;
- then notify-send --icon=gnome-screenshot "Screenshot" "Screenshot taken" -t 2000;
- else notify-send --icon=error "Error" "Failed to Create file" -t 2000;
- fi
- }
- if [[ $# ]]; then
- case $1 in
- "-d" | "--desktop" )
- escrotum -fC "$location""$filename".png && NotifyAction;;
- "-s" | "--select" )
- escrotum -sC "$location""$filename".png && NotifyAction;;
- "-w" | "--window" )
- currentWin=$(xdotool getactivewindow)
- escrotum -x "$currentWin" "$location""$filename".png && xclip -selection clipboard -t image/png "$location""$filename".png && NotifyAction;;
- * | "-h" | "--help" )
- echo -e "Usage: $0 [OPTION]\n"
- echo -e "\e[4mOption Long Option Purpose\e[0m"
- echo "-d --desktop Captures whole desktop - including other monitors."
- echo "-s --select Select a window to capture."
- echo "-w --window Captures active window."
- echo "-h --help Show this list of options";;
- esac
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement