dotfiles

personal dotfiles
git clone anongit@rnpnr.xyz:dotfiles.git
Log | Files | Refs | Feed | Submodules

screenshot (788B)


      1 #!/bin/sh
      2 
      3 # select an area and perform the selected action
      4 
      5 output="$(date -u +%Y年%m月%d日%T).png"
      6 clip_cmd="xclip -sel clip -t image/png"
      7 
      8 options="\
      9 area (copy)
     10 current window (copy)
     11 full screen (copy)
     12 area
     13 current window
     14 full screen
     15 OCR"
     16 
     17 case $(echo "$options" | dmenu -i -l 7 -p "Screenshot: ") in
     18 "area (copy)")
     19 	sxot -g "$(selx)" | optipng-pipe | ${clip_cmd} ;;
     20 "current window (copy)")
     21 	sxot -g "$(selx -w "$(xdotool getactivewindow)")" | optipng-pipe | ${clip_cmd} ;;
     22 "full screen (copy)")
     23 	sxot | optipng-pipe | ${clip_cmd} ;;
     24 "area")
     25 	sxot -g "$(selx)" | optipng-pipe > "sel-${output}" ;;
     26 "current window")
     27 	sxot -g "$(selx -w "$(xdotool getactivewindow)")" | optipng-pipe > "win-${output}" ;;
     28 "full screen")
     29 	sxot | optipng-pipe > "full-${output}" ;;
     30 "OCR")
     31 	ocr ;;
     32 esac