Flameshot content directly send to clipboard
This commit is contained in:
parent
7758c84569
commit
49aaa26a64
13
printscreen
13
printscreen
|
@ -130,19 +130,28 @@ fi
|
|||
|
||||
## Use Flameshot if available {{{
|
||||
if [ "$(command -v flameshot)" ]; then
|
||||
### Take a capture {{{
|
||||
### --raw : To prevent flameshot from returing immediately
|
||||
### --path : Default path to store saved image
|
||||
### --delay : Wait XX milliseconds before launching flameshot
|
||||
### And immediately send PNG raw to clipboard
|
||||
if [ "${DELAYED_MODE}" -eq "0" ]; then
|
||||
debug_message "Flameshot tool − \
|
||||
DELAYED_MODE enabled."
|
||||
## Convert delay screenshot to milliseconds
|
||||
delay_screenshot="$(( ${delay_screenshot} * 1000 ))"
|
||||
## Open flameshot after "${delay_screenshot}" seconds
|
||||
flameshot gui --path /tmp --delay "${delay_screenshot}"
|
||||
flameshot gui --raw --path /tmp --delay "${delay_screenshot}" | xclip -selection clipboard -t image/png
|
||||
else
|
||||
debug_message "Flameshot tool − \
|
||||
Capture with gui."
|
||||
## Open flameshot
|
||||
flameshot gui --path /tmp --delay 50
|
||||
flameshot gui --raw --path /tmp --delay 50 | xclip -selection clipboard -t image/png
|
||||
fi
|
||||
### }}}
|
||||
### Store the clipboard content to a new image file
|
||||
xclip -out -selection clipboard -t image/png > /tmp/$(date +%Y%m%d-%H%M%S)."${PROGNAME}".png
|
||||
|
||||
## }}}
|
||||
else ## Use Scrot {{{
|
||||
debug_message "Scrot tool − \
|
||||
|
|
|
@ -135,33 +135,31 @@ fi
|
|||
## Use Flameshot if available {{{
|
||||
if [ "$(command -v flameshot)" ]; then
|
||||
### Take a capture {{{
|
||||
### --raw : To prevent flameshot from returing immediately
|
||||
### --path : Default path to store saved image
|
||||
### --delay : Wait XX milliseconds before launching flameshot
|
||||
### And immediately send PNG raw to clipboard
|
||||
if [ "${DELAYED_MODE}" -eq "0" ]; then
|
||||
debug_message "Flameshot tool − \
|
||||
DELAYED_MODE enabled."
|
||||
## Convert delay screenshot to milliseconds
|
||||
delay_screenshot="$(( ${delay_screenshot} * 1000 ))"
|
||||
## Open flameshot after "${delay_screenshot}" seconds
|
||||
flameshot gui --path /tmp --delay "${delay_screenshot}"
|
||||
flameshot gui --raw --path /tmp --delay "${delay_screenshot}" | xclip -selection clipboard -t image/png
|
||||
else
|
||||
debug_message "Flameshot tool − \
|
||||
Capture with gui."
|
||||
## Open flameshot
|
||||
flameshot gui --path /tmp --delay 50
|
||||
flameshot gui --raw --path /tmp --delay 50 | xclip -selection clipboard -t image/png
|
||||
fi
|
||||
### }}}
|
||||
|
||||
### Get full path of the image file of the capture
|
||||
### If the capture was successfully saved
|
||||
if find /tmp -maxdepth 1 -mmin -1 -iname "*.png" > /dev/null 2>&1; then
|
||||
### Get the absolut path of the most recent image
|
||||
img_absolut_path="$(find /tmp -maxdepth 1 -mmin -1 -iname "*.png" | sort | tail -n 1)"
|
||||
debug_message "Flameshot tool − \
|
||||
Absolut path of the most recent image in /tmp: ${img_absolut_path}."
|
||||
else
|
||||
debug_message "Flameshot tool − \
|
||||
No recent image in /tmp."
|
||||
fi
|
||||
echo "${img_absolut_path}" | xclip -rmlastnl -selection clipboard
|
||||
### Store the clipboard content to a new image file
|
||||
xclip -out -selection clipboard -t image/png > /tmp/$(date +%Y%m%d-%H%M%S)."${PROGNAME}".png
|
||||
|
||||
### Store the absolut path of the new image file to clipboard
|
||||
echo "/tmp/$(date +%Y%m%d-%H%M%S).${PROGNAME}.png" | xclip -rmlastnl -selection clipboard
|
||||
|
||||
## }}}
|
||||
else ## Use Scrot {{{
|
||||
debug_message "Scrot tool − \
|
||||
|
|
Loading…
Reference in New Issue