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