aboutsummaryrefslogtreecommitdiff
path: root/scripts/.local/bin/personal/screenshot
blob: 937a023d524e432f3a522671de49cc0e5870c008 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

directory="$HOME/images/screenshots"
file="$directory/$(date +%F_%s).jpg"

notify() {
  notify-send "Screenshot saved" "images/screenshots/$(date +%F_%H-%M)"
}

case "$1" in
  "full")
    flameshot full -r > "$file" && notify ;;
  "select")
    flameshot gui -r > "$file"
    if [[ "$(stat $file | grep 'Size' | awk '{print $2}')" == "0" ]]; then
      rm "$file"
    else
      notify
    fi
    ;;
  *)
    notify-send "Error" "Couldn't save screenshot" ;;
esac