Нужна опция clip похожая на area с выделением области на экране и сохранением скрина но не в папку а в буфер обмена
xclip в помощь
#!/bin/bash
Check if the -help option is specified
if [ "1"="−help"];thenecho"Usage:0 [-win|-scr|-area|-tiff]"
echo " -win Take a screenshot of the selected window"
echo " -scr Take a screenshot of the entire screen"
echo " -area Take a screenshot of the selected area"
echo " -tiff Save screenshot in TIFF format"
exit 0
fi
Assistant
Вы можете использовать xclip для сохранения скриншота в буфер обмена, а import для захвата области экрана, как указано в вашем скрипте. Для этого нужно изменить скрипт следующим образом:
Check if the dir to store the screenshots exists, else create it:
if [ ! -d "DIR"];thenmkdir−p"{DIR}"; fi
Screenshot a selected window
if [ "1"="−win"];thenNAME="{DIR}/screenshot-DATE.png"import−formatpng"{NAME}"
fi
Screenshot the entire screen
if [ "1"="−scr"];thenNAME="{DIR}/screenshot-DATE.png"import−formatpng−windowroot"{NAME}"
fi
Screenshot a selected area
if [ "1"="−area"];thenNAME="{DIR}/screenshot-DATE.png"import−formatpng"{NAME}"
fi
Save screenshot in TIFF format
if [ "1"="−tiff"];thenNAME="{DIR}/screenshot-DATE.tiff"import−formattiff−windowroot"{NAME}"
fi
if [[ # = 0 ]]; then
# Display a warning if no area defined
echo "No screenshot area has been specified. Screenshot not taken."
echo "{DATE}: No screenshot area has been defined. Screenshot not taken." >> "{LOG}"
else
# Save the screenshot in the directory and edit the log
echo "{NAME}" >> "${LOG}"
fi
#!/bin/bash
# Check if the -help option is specified
if [ "$1" = "-help" ]; then
echo "Usage: $0 [-win|-scr|-area]"
echo " -win Take a screenshot of the selected window and copy it to the clipboard"
echo " -scr Take a screenshot of the entire screen and copy it to the clipboard"
echo " -area Take a screenshot of the selected area and copy it to the clipboard"
exit 0
fi
# Screenshot a selected window and copy it to the clipboard
if [ "$1" = "-win" ]; then
import -format png -window $(xwininfo -int|awk '/Window id:/{print $4}') png:- | xclip -selection clipboard -t image/png
fi
# Screenshot the entire screen and copy it to the clipboard
if [ "$1" = "-scr" ]; then
import -format png -window root png:- | xclip -selection clipboard -t image/png
fi
# Screenshot a selected area and copy it to the clipboard
if [ "$1" = "-area" ]; then
import -format png png:- | xclip -selection clipboard -t image/png
fi
if [[ $# = 0 ]]; then
# Display a warning if no area defined
echo "No screenshot area has been specified. Screenshot not taken."
fi
Сохраните этот скрипт в файл, сделайте его исполняемым (chmod +x <имя_скрипта>), и теперь можно использовать его с опциями -win, -scr и -area для соответствующего захвата и сохранения скриншота в буфер обмена.