Fix file naming and add some cli flags

This commit is contained in:
Sheldon Lee 2023-06-07 09:43:19 +01:00
parent a084750335
commit 7d6fb682bb

View File

@ -69,7 +69,7 @@ prompt_gif() {
30s\n\ 30s\n\
60s 60s
" "
option=$(echo -e $options | menucmd) option=$(echo -e $options | $menucmd)
case $option in case $option in
10s) 10s)
@ -88,7 +88,7 @@ prompt_gif() {
s_scrot() { s_scrot() {
name=$(date +${date_format}_sel.png) name=$(date +${date_format}_sel.png)
path="${scrot_dir}/${name}" 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 xclip -sel clip $path -t image/png
} }
@ -108,14 +108,14 @@ f_grimshot() {
} }
s_grimshot() { s_grimshot() {
name=$(date +${date_format}_full.png) name=$(date +${date_format}_sel.png)
path="${scrot_dir}/${name}" path="${scrot_dir}/${name}"
$grimshot save area $path && $grimshot save area $path &&
wl-copy --type image/png < $path wl-copy --type image/png < $path
} }
w_grimshot() { w_grimshot() {
name=$(date +${date_format}_full.png) name=$(date +${date_format}_sel.png)
path="${scrot_dir}/${name}" path="${scrot_dir}/${name}"
$grimshot save window $path && $grimshot save window $path &&
wl-copy --type image/png < $path wl-copy --type image/png < $path
@ -129,9 +129,37 @@ byzanz_gif() {
} }
if [[ -n $WAYLAND_DISPLAY ]]; then 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 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 else
echo "Error: No Wayland or X11 display detected" >&2 echo "Error: No Wayland or X11 display detected" >&2
exit 1 exit 1