Enable DELAYED_MODE (wait XX seconds) for flameshot

This commit is contained in:
Jeremy Gardais 2020-12-01 17:14:04 +01:00
parent 1b4dbb3d54
commit 4a04e746dd
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 15 additions and 7 deletions

View File

@ -37,10 +37,10 @@ if [ ! "${NBARGS}" -eq "0" ]; then
## Use it to delay screenshot
if ! printf -- '%s' "${1}" | grep -q -E -- "^-+";
then
## Use this argument for delay_screenshot
## Use this argument for delay_screenshot (in seconds)
delay_screenshot="${1}"
## Enable FULL screenshot mode
FULL_MODE="0"
## Enable DELAYED screenshot mode
DELAYED_MODE="0"
## Switch to the next argument
shift
@ -52,11 +52,11 @@ if [ ! "${NBARGS}" -eq "0" ]; then
case "${1}" in
-d|--delay ) ## Add a delay
## Enable FULL screenshot mode
FULL_MODE="0"
## Enable DELAYED screenshot mode
DELAYED_MODE="0"
## Move to the next argument
shift
## Define the delay with this argument
## Define the delay with this argument (in seconds)
delay_screenshot="${1}"
;;
* ) ## unknow option
@ -86,7 +86,15 @@ fi
## Use Flameshot if available {{{
if [ "$(command -v flameshot)" ]; then
if [ "${DELAYED_MODE}" -eq "0" ]; then
## Convert delay screenshot to milliseconds
delay_screenshot="$(( ${delay_screenshot} * 1000 ))"
## Open flameshot after "${delay_screenshot}" seconds
flameshot gui --path /tmp --delay "${delay_screenshot}"
else
## Open flameshot
flameshot gui --path /tmp --delay 50
fi
## }}}
else ## Use Scrot {{{
# -s: Interactively select a window or rectangle with the mouse.