summaryrefslogtreecommitdiff
path: root/bin/screenshot
blob: c2049df6c45a6577afca90b0061e2a7f2fafebe2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
FILENAME=$(date +%m-%d-%Y_%R:%S)
mkdir -p ~/pictures/screenshots

# using ImageMagick's import
#if [ $1 = 1 ]; then
#  import clipboard:
#  notify-send "Screenshot taken" "copied to clipboard" -i :
#else
#  import -window root ~/pictures/screenshots/"$FILENAME".png
#  notify-send "Screenshot taken" "saved to ~/pictures/screenshots/$FILENAME.png" -i :
#fi

# using naelstrof's maim and slop
if [ $1 = 1 ]; then
  #maim -i $(xdotool getactivewindow) | xclip -selection clipboard -t image/png
  CHOICE=$(printf "clipboard\nfile" | dmenu -c -i -l 2)
  case $CHOICE in
    "clipboard")
      maim -s | xclip -selection clipboard -t image/png
      notify-send "Screenshot taken" "copied to clipboard" -i :;;
    "file")
      maim -s ~/pictures/screenshots/"$FILENAME".bmp
      notify-send "Screenshot taken" "saved to ~/pictures/screenshots/$FILENAME.bmp" -i :;;
  esac

else
  maim ~/pictures/screenshots/"$FILENAME".bmp
  notify-send "Screenshot taken" "saved to ~/pictures/screenshots/$FILENAME.png" -i :
fi