diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2026-05-06 08:30:49 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2026-05-06 08:30:49 +0200 |
| commit | 60052659b98832c78c902e4f27ecee2663d8e913 (patch) | |
| tree | 9efc1388569c43456557aa1975b4bec99bf06c94 /scripts/dmenu-screenshot | |
| parent | 10e16c2fb2266bb2b46ec7ea64d721de0c29a0d9 (diff) | |
| download | config-60052659b98832c78c902e4f27ecee2663d8e913.tar.gz config-60052659b98832c78c902e4f27ecee2663d8e913.zip | |
Added scripts
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 | ||
