diff options
| -rwxr-xr-x | bin/.local/bin/scrot_cmd | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/bin/.local/bin/scrot_cmd b/bin/.local/bin/scrot_cmd index 1ae39a2..5076468 100755 --- a/bin/.local/bin/scrot_cmd +++ b/bin/.local/bin/scrot_cmd @@ -3,14 +3,16 @@ # a simple scrot wrapper to be used wm-agnostically usage() { - echo "usage: $0 [-n|--no-notify] [mode]" + echo "usage: $0 [options] [mode]" echo + echo "options:" echo " -n, --no-notify do not show a notification on success" + echo " -x, --no-copy don't copy capture to clipboard" echo echo "modes:" echo " -f, --full capture the whole screen" echo " -a, --area select area and capture it" - echo " -c, --focused capture only focused window" + echo " -w, --focused capture only focused window" echo echo "note: last specified mode will be chosen" } @@ -18,12 +20,16 @@ usage() { scrot_cmd() { # scrot_cmd flags path - _scrot_exec="echo \$f >/dev/null" + _scrot_exec="true" [ "$_scrot_notify" = "YES" ] && { _scrot_exec="notify-send -t $_scrot_notify_duration \"scrot\" \ \"screenshot of $_scrot_human_readable_mode is saved to \$f\"" } + [ "$_scrot_copy_to_clipboard" = "YES" ] && { + _scrot_exec="$_scrot_exec && cat \$f | xclip -t image/png -sel c" + } + # shellcheck disable=SC2086 scrot $1 "$2" -e "$_scrot_exec" } @@ -35,6 +41,7 @@ main() { _scrot_path="$_scrot_dir/$_scrot_name" _scrot_notify="YES" _scrot_notify_duration="3000" + _scrot_copy_to_clipboard="YES" _scrot_flags="" _scrot_human_readable_mode="full screen" @@ -52,10 +59,13 @@ main() { _scrot_flags="-s -f" _scrot_human_readable_mode="screen area" ;; - -c|--focused) + -w|--focused) _scrot_flags="-u" _scrot_human_readable_mode="active window" ;; + -x|--no-copy) + _scrot_copy_to_clipboard="NO" + ;; *) usage exit 1 |
