Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Activate wayland overlay as described in [README](https://github.com/bsd-ac/wayl
### Optional Dependencies

- hyprpicker (to freeze the screen contents with the `--freeze` flag)
- xdg-utils (to open image file in the default image viewer in response to a configured notification action.)

### Manual

Expand Down
17 changes: 12 additions & 5 deletions hyprshot
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,19 @@ function send_notification() {
return 0
fi

local message=$([ $CLIPBOARD -eq 1 ] && \
echo "Image copied to the clipboard" || \
local message=$([ $CLIPBOARD -eq 1 ] &&
echo "Image copied to the clipboard" ||
echo "Image saved in <i>${1}</i> and copied to the clipboard.")
notify-send "Screenshot saved" \
"${message}" \
-t "$NOTIF_TIMEOUT" -i "${1}" -a Hyprshot

action_option=""
command -v xdg-open &>/dev/null && action_option="--action=open_file=Open"

local action=$(notify-send "Screenshot saved" \
"${message}" \
-t "$NOTIF_TIMEOUT" -i "${1}" -a Hyprshot \
"$action_option")

[[ $action_option != "" && $action == "open_file" ]] && xdg-open "$1" &
}

function trim() {
Expand Down