Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions grimshot/grimshot
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ any() {
return 0
fi
done
return 1 # No conditions matched
return 1 # No conditions matched
}

NOTIFY=no
Expand Down Expand Up @@ -121,15 +121,24 @@ printUsageMsg() {
}

notify() {
notify-send -t 3000 -a grimshot "$@"
if [ "$ACTION" = "copy" ]; then
notify-send -t 3000 -a grimshot "$@"
else
action=$(notify-send -t 3000 -a grimshot --action=file='Open File' --action=dir='Open Directory' "$@")
if [ "$action" = "file" ]; then
xdg-open "$FILE"
elif [ "$action" = "dir" ]; then
xdg-open "$(dirname "$FILE")"
fi
fi
}

notifyOk() {
notify_disabled='[ "$NOTIFY" = "no" ]'
action_involves_saving='[ "$ACTION" = "save" ] || [ "$ACTION" = "savecopy" ]'

if eval $notify_disabled; then
return
return
fi

TITLE=${2:-"Screenshot"}
Expand Down Expand Up @@ -193,6 +202,7 @@ checkRequiredTools() {
check wl-copy
check jq
check notify-send
check xdg-open
exit
}

Expand Down