fix an empty OUTPUT

parent db5087a1
#!/bin/bash
CLIPBOARD=0
RAW=0
COPY=false
print_error() {
printf "\033[1;31m%s\033[0m\n" "$1"
......@@ -98,16 +97,11 @@ process_screenshot() {
local app="$2"
local geometry="$3"
if [ -z "$output_file" ] && [ ! "$COPY" ]; then
print_error "OUTPUT не указан"
return 1
fi
case "$app" in
"")
if [ "$output_file" = "-" ]; then
wayshot -s "${geometry}" --stdout
else
elif [ -n "$output_file" ]; then
wayshot -s "${geometry}" -f "$output_file"
fi
if [ "$COPY" == "true" ]; then
......@@ -127,8 +121,13 @@ process_screenshot() {
save_geometry() {
local geometry="${1}"
if [ -z "$OUTPUT" ] && [ "$COPY" == "false" ]; then
OUTPUT="$(xdg-user-dir PICTURES)/Снимки экрана/снимок-$(date +%Y%m%d-%H%M%S).png"
fi
if [ -n "$OUTPUT" ] && [ "$OUTPUT" != "-" ]; then
mkdir -p $(dirname ${OUTPUT})
OUTPUT_DIR=$(dirname "${OUTPUT}")
mkdir -p "$OUTPUT_DIR"
fi
if [ "$COMMAND" ]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment