aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorla-ninpre <leobrekalini@gmail.com>2022-04-10 17:59:51 +0300
committerla-ninpre <leobrekalini@gmail.com>2022-04-10 17:59:51 +0300
commitf1a8419e0898ff0ce4db37a7e4ae92aff76d81fb (patch)
treef6405494455180d9f6be69d34b83adfbcb34f0fa
parent6bc3644cc96445ad387f6a55dabdbbd5d232eea6 (diff)
downloaddotfiles-f1a8419e0898ff0ce4db37a7e4ae92aff76d81fb.tar.gz
dotfiles-f1a8419e0898ff0ce4db37a7e4ae92aff76d81fb.zip
scrot_cmd: copy scrot to clipboard by default
and add flag to disable this option
-rwxr-xr-xbin/.local/bin/scrot_cmd18
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