From 4a04e746dd323eb26e7b2d47e7a20c68bbcd6af9 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Tue, 1 Dec 2020 17:14:04 +0100 Subject: [PATCH] Enable DELAYED_MODE (wait XX seconds) for flameshot --- printscreen | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/printscreen b/printscreen index 35f3335..ccfa962 100755 --- a/printscreen +++ b/printscreen @@ -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 - flameshot gui --path /tmp --delay 50 + 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.