diff options
Diffstat (limited to 'scripts/dmenu-screenshot')
| -rwxr-xr-x | scripts/dmenu-screenshot | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/dmenu-screenshot b/scripts/dmenu-screenshot new file mode 100755 index 0000000..e2e8adf --- /dev/null +++ b/scripts/dmenu-screenshot | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # Screenshot utility | ||
| 4 | # Requires: dmenu (or similar), imagemagick | ||
| 5 | |||
| 6 | # Usage: dmenu-screenshot [-m menu] | ||
| 7 | |||
| 8 | usage() { | ||
| 9 | echo "Usage: dmenu-screenshot [-m MENU]" | ||
| 10 | } | ||
| 11 | |||
| 12 | menu="dmenu -i" | ||
| 13 | prompt="Select type of screenshot:" | ||
| 14 | |||
| 15 | while getopts "m:" opt; do | ||
| 16 | case "$opt" in | ||
| 17 | m) | ||
| 18 | menu="$OPTARG" | ||
| 19 | ;; | ||
| 20 | *) | ||
| 21 | usage | ||
| 22 | exit 1 | ||
| 23 | ;; | ||
| 24 | esac | ||
| 25 | done | ||
| 26 | shift $((OPTIND - 1)) | ||
| 27 | |||
| 28 | folder="$HOME/box/pictures/screenshots" | ||
| 29 | filename="screenshot_$(date +%Y-%m-%d-%H%M%S).png" | ||
| 30 | filepath="${folder}/${filename}" | ||
| 31 | |||
| 32 | t=$(printf 'Full\nSelection\n' | $menu -p "$prompt") | ||
| 33 | if [ "$t" = "Full" ]; then | ||
| 34 | op="-window root" | ||
| 35 | else | ||
| 36 | pkill xbanish # otherwise I can't use mouse to select area | ||
| 37 | fi | ||
| 38 | |||
| 39 | [ -n "$t" ] && sleep 0.1 && import $op "$filepath" | ||
| 40 | spawn xbanish # This can be removed if you don't use xbanish | ||
