Skip to content

Commit

Permalink
Close #42
Browse files Browse the repository at this point in the history
  • Loading branch information
ProMix0 committed May 2, 2024
1 parent 36dbe2e commit e199636
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions hyprshot
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function send_notification() {
return 0
fi

local message=$([ $CLIPBOARD -eq 1 ] && \
local message=$([ -z "$1" ] && \
echo "Image copied to the clipboard" || \
echo "Image saved in <i>${1}</i> and copied to the clipboard.")
notify-send "Screenshot saved" \
Expand Down Expand Up @@ -104,23 +104,22 @@ function save_geometry() {
Print "Crop: %s\n" "${cropped_geometry}"
local output=""

if [ $RAW -eq 1 ]; then
grim -g "${cropped_geometry}" -
return 0
fi
local SCREEN_COMMAND='grim -g '"'${cropped_geometry}'"' -'

if [ $CLIPBOARD -eq 0 ]; then
mkdir -p "$SAVEDIR"
grim -g "${cropped_geometry}" "$SAVE_FULLPATH"
output="$SAVE_FULLPATH"
wl-copy < "$output"
[ -z "$COMMAND" ] || {
"$COMMAND" "$output"
}
else
wl-copy < <(grim -g "${cropped_geometry}" -)
SCREEN_COMMAND="$SCREEN_COMMAND"' | tee '"'$SAVE_FULLPATH'"
fi

SCREEN_COMMAND="$SCREEN_COMMAND"' | tee >(wl-copy)'

if [ $RAW -eq 0 ]; then
SCREEN_COMMAND="$SCREEN_COMMAND"' > /dev/null'
fi

Print "Executing %s\n" "$SCREEN_COMMAND"
eval "$SCREEN_COMMAND"

send_notification $output
}

Expand Down

0 comments on commit e199636

Please sign in to comment.