This commit is contained in:
adi1090x 2022-02-01 15:36:41 +05:30
parent 0878841230
commit 417b692800
2 changed files with 30 additions and 26 deletions

View File

@ -17,10 +17,12 @@ if ! . "$MENUS_LIBDIR/archcraft.cfg" 2> /dev/null; then
exit 1
fi
# notify
notify_user () {
# notify and view screenshot
notify_view () {
dunstify -u low --replace=699 -i /usr/share/archcraft/icons/dunst/picture.png "Copied to clipboard."
viewnior ${dir}/"$file"
if [[ -e "$dir/$file" ]]; then
dunstify -u low --replace=699 -i /usr/share/archcraft/icons/dunst/picture.png "Saved in $dir"
dunstify -u low --replace=699 -i /usr/share/archcraft/icons/dunst/picture.png "Screenshot Saved."
else
dunstify -u low --replace=699 -i /usr/share/archcraft/icons/dunst/picture.png "Screenshot Deleted."
fi
@ -36,30 +38,30 @@ countdown () {
# take shots
shotnow () {
cd ${dir} && sleep 0.5 && maim -u -f png "$file" && viewnior ${dir}/"$file"
notify_user
cd ${dir} && sleep 0.5 && maim -u -f png | tee "$file" | xclip -selection clipboard -t image/png
notify_view
}
shot5 () {
countdown '5'
sleep 1 && cd ${dir} && maim -u -f png "$file" && viewnior ${dir}/"$file"
notify_user
sleep 1 && cd ${dir} && maim -u -f png | tee "$file" | xclip -selection clipboard -t image/png
notify_view
}
shot10 () {
countdown '10'
sleep 1 && cd ${dir} && maim -u -f png "$file" && viewnior ${dir}/"$file"
notify_user
sleep 1 && cd ${dir} && maim -u -f png | tee "$file" | xclip -selection clipboard -t image/png
notify_view
}
shotwin () {
cd ${dir} && maim -u -f png -i `xdotool getactivewindow` "$file" && viewnior ${dir}/"$file"
notify_user
cd ${dir} && maim -u -f png -i `xdotool getactivewindow` | tee "$file" | xclip -selection clipboard -t image/png
notify_view
}
shotarea () {
cd ${dir} && maim -u -f png -s -b 2 -c 0.35,0.55,0.85,0.25 -l "$file" && viewnior ${dir}/"$file"
notify_user
cd ${dir} && maim -u -f png -s -b 2 -c 0.35,0.55,0.85,0.25 -l | tee "$file" | xclip -selection clipboard -t image/png
notify_view
}
if [[ ! -d "$dir" ]]; then

View File

@ -28,10 +28,12 @@ else
inten=" Take in 10s"
fi
# notify
notify_user () {
# notify and view screenshot
notify_view () {
dunstify -u low --replace=699 -i /usr/share/archcraft/icons/dunst/picture.png "Copied to clipboard."
viewnior ${dir}/"$file"
if [[ -e "$dir/$file" ]]; then
dunstify -u low --replace=699 -i /usr/share/archcraft/icons/dunst/picture.png "Saved in $dir"
dunstify -u low --replace=699 -i /usr/share/archcraft/icons/dunst/picture.png "Screenshot Saved."
else
dunstify -u low --replace=699 -i /usr/share/archcraft/icons/dunst/picture.png "Screenshot Deleted."
fi
@ -47,30 +49,30 @@ countdown () {
# take shots
shotnow () {
cd ${dir} && sleep 0.5 && maim -u -f png "$file" && viewnior ${dir}/"$file"
notify_user
cd ${dir} && sleep 0.5 && maim -u -f png | tee "$file" | xclip -selection clipboard -t image/png
notify_view
}
shot5 () {
countdown '5'
sleep 1 && cd ${dir} && maim -u -f png "$file" && viewnior ${dir}/"$file"
notify_user
sleep 1 && cd ${dir} && maim -u -f png | tee "$file" | xclip -selection clipboard -t image/png
notify_view
}
shot10 () {
countdown '10'
sleep 1 && cd ${dir} && maim -u -f png "$file" && viewnior ${dir}/"$file"
notify_user
sleep 1 && cd ${dir} && maim -u -f png | tee "$file" | xclip -selection clipboard -t image/png
notify_view
}
shotwin () {
cd ${dir} && maim -u -f png -i `xdotool getactivewindow` "$file" && viewnior ${dir}/"$file"
notify_user
cd ${dir} && maim -u -f png -i `xdotool getactivewindow` | tee "$file" | xclip -selection clipboard -t image/png
notify_view
}
shotarea () {
cd ${dir} && maim -u -f png -s -b 2 -c 0.35,0.55,0.85,0.25 -l "$file" && viewnior ${dir}/"$file"
notify_user
cd ${dir} && maim -u -f png -s -b 2 -c 0.35,0.55,0.85,0.25 -l | tee "$file" | xclip -selection clipboard -t image/png
notify_view
}
if [[ ! -d "$dir" ]]; then