fix an empty OUTPUT

parent db5087a1
#!/bin/bash #!/bin/bash
CLIPBOARD=0 COPY=false
RAW=0
print_error() { print_error() {
printf "\033[1;31m%s\033[0m\n" "$1" printf "\033[1;31m%s\033[0m\n" "$1"
...@@ -98,16 +97,11 @@ process_screenshot() { ...@@ -98,16 +97,11 @@ process_screenshot() {
local app="$2" local app="$2"
local geometry="$3" local geometry="$3"
if [ -z "$output_file" ] && [ ! "$COPY" ]; then
print_error "OUTPUT не указан"
return 1
fi
case "$app" in case "$app" in
"") "")
if [ "$output_file" = "-" ]; then if [ "$output_file" = "-" ]; then
wayshot -s "${geometry}" --stdout wayshot -s "${geometry}" --stdout
else elif [ -n "$output_file" ]; then
wayshot -s "${geometry}" -f "$output_file" wayshot -s "${geometry}" -f "$output_file"
fi fi
if [ "$COPY" == "true" ]; then if [ "$COPY" == "true" ]; then
...@@ -127,8 +121,13 @@ process_screenshot() { ...@@ -127,8 +121,13 @@ process_screenshot() {
save_geometry() { save_geometry() {
local geometry="${1}" 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 if [ -n "$OUTPUT" ] && [ "$OUTPUT" != "-" ]; then
mkdir -p $(dirname ${OUTPUT}) OUTPUT_DIR=$(dirname "${OUTPUT}")
mkdir -p "$OUTPUT_DIR"
fi fi
if [ "$COMMAND" ]; then 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