From 7d6fb682bb0ad1ec61795eb6124d22ed3ad2a98d Mon Sep 17 00:00:00 2001 From: Sheldon Lee Date: Wed, 7 Jun 2023 09:43:19 +0100 Subject: [PATCH] Fix file naming and add some cli flags --- .config/scripts/wm/screenshot.sh | 40 +++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/.config/scripts/wm/screenshot.sh b/.config/scripts/wm/screenshot.sh index 6a8cfbf..e7a2072 100755 --- a/.config/scripts/wm/screenshot.sh +++ b/.config/scripts/wm/screenshot.sh @@ -69,7 +69,7 @@ prompt_gif() { 30s\n\ 60s " - option=$(echo -e $options | menucmd) + option=$(echo -e $options | $menucmd) case $option in 10s) @@ -88,7 +88,7 @@ prompt_gif() { s_scrot() { name=$(date +${date_format}_sel.png) path="${scrot_dir}/${name}" - scrot -a $(slop -f "%x,%y,%w,%h") $path && + crot -a $(slop -f "%x,%y,%w,%h") $path && xclip -sel clip $path -t image/png } @@ -108,14 +108,14 @@ f_grimshot() { } s_grimshot() { - name=$(date +${date_format}_full.png) + name=$(date +${date_format}_sel.png) path="${scrot_dir}/${name}" $grimshot save area $path && wl-copy --type image/png < $path } w_grimshot() { - name=$(date +${date_format}_full.png) + name=$(date +${date_format}_sel.png) path="${scrot_dir}/${name}" $grimshot save window $path && wl-copy --type image/png < $path @@ -129,9 +129,37 @@ byzanz_gif() { } if [[ -n $WAYLAND_DISPLAY ]]; then - prompt_wayland + case $1 in + -f) + sleep 0.5 + f_grimshot + ;; + -s) + s_grimshot + ;; + -w) + w_grimshot + ;; + *) + prompt_wayland + ;; + esac elif [[ -n $DISPLAY ]]; then - prompt_xorg + case $1 in + -f) + sleep 0.5 + f_scrot + ;; + -s) + s_scrot + ;; + -w) + s_scrot + ;; + *) + prompt_xorg + ;; + esac else echo "Error: No Wayland or X11 display detected" >&2 exit 1