mirror of
https://github.com/foo-dogsquared/dotfiles.git
synced 2025-02-07 06:18:59 +00:00
Create screenshot scripts
This commit is contained in:
parent
2a7503dc49
commit
c36c5fdaba
32
.scripts/maim-screenshot.sh
Normal file
32
.scripts/maim-screenshot.sh
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Simply captures an image with regional selection.
|
||||||
|
|
||||||
|
# Here are the dependencies needed to successfully
|
||||||
|
# run this script:
|
||||||
|
# * maim (version 5.5.3)
|
||||||
|
# * date (version 8.31)
|
||||||
|
|
||||||
|
# setting up variables for the color
|
||||||
|
red="\u001b[31m"
|
||||||
|
green="\u001b[32m"
|
||||||
|
reset="\u001b[0m"
|
||||||
|
|
||||||
|
function error_cleanup() {
|
||||||
|
rm "$pic_filepath"
|
||||||
|
printf "$red An error occurred on line $1\n $reset"
|
||||||
|
}
|
||||||
|
|
||||||
|
# setting up a exit trap in case of error
|
||||||
|
trap 'error_cleanup $LINENO' ERR
|
||||||
|
|
||||||
|
pic_directory=${PICTURES_DIRECTORY:-"$HOME/Pictures"}
|
||||||
|
|
||||||
|
date_format=$(date +%F-%H-%M-%S)
|
||||||
|
|
||||||
|
pic_filepath=$pic_directory/$date_format.png
|
||||||
|
|
||||||
|
maim_process=$(maim $pic_filepath --hidecursor)
|
||||||
|
|
||||||
|
notify-send "Screenshot taken" "It is saved at $(pic_filepath)."
|
||||||
|
|
33
.scripts/maim-selection-screenshot.sh
Normal file
33
.scripts/maim-selection-screenshot.sh
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Simply captures an image with regional selection.
|
||||||
|
|
||||||
|
# Here are the dependencies needed to successfully
|
||||||
|
# run this script (as of creating this script):
|
||||||
|
# * slop (version 7.4)
|
||||||
|
# * maim (version 5.5.3)
|
||||||
|
# * date (version 8.31)
|
||||||
|
|
||||||
|
# setting up variables for the color
|
||||||
|
red="\u001b[31m"
|
||||||
|
green="\u001b[32m"
|
||||||
|
reset="\u001b[0m"
|
||||||
|
|
||||||
|
function error_cleanup() {
|
||||||
|
rm "$pic_filepath"
|
||||||
|
printf "$red An error occurred on line $1\n $reset"
|
||||||
|
}
|
||||||
|
|
||||||
|
# setting up a exit trap in case of error
|
||||||
|
trap 'error_cleanup $LINENO' ERR
|
||||||
|
|
||||||
|
pic_directory=${PICTURES_DIRECTORY:-"$HOME/Pictures"}
|
||||||
|
|
||||||
|
geometry_coordinates=$(slop)
|
||||||
|
date_format=$(date +%F-%H-%M-%S)
|
||||||
|
|
||||||
|
pic_filepath=$pic_directory/$date_format-$geometry_coordinates.png
|
||||||
|
|
||||||
|
maim_process=$(maim $pic_filepath --geometry=$geometry_coordinates)
|
||||||
|
|
||||||
|
notify-send "screenshot" --hint:string:path:$pic_filepath
|
Loading…
Reference in New Issue
Block a user