diff options
| author | srdusr <trevorgray@srdusr.com> | 2024-01-11 22:51:59 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2024-01-11 22:51:59 +0200 |
| commit | e125879b4b9074a1999633c8bfd2a36644b45bb9 (patch) | |
| tree | 5fd9ba5907ba1396cd1ea45d371fe50af2a0ad97 /screenshot | |
| parent | 1c584837e851cb969518bb80a762ba1b59d4ba1f (diff) | |
| download | dotfiles-e125879b4b9074a1999633c8bfd2a36644b45bb9.tar.gz dotfiles-e125879b4b9074a1999633c8bfd2a36644b45bb9.zip | |
Add screenshot script
Diffstat (limited to 'screenshot')
| -rwxr-xr-x | screenshot | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/screenshot b/screenshot new file mode 100755 index 0000000..25fc3bd --- /dev/null +++ b/screenshot @@ -0,0 +1,38 @@ +#!/bin/bash + +DATE="$(date +'%d-%m-%y_%H:%M:%S')" +DIR="$HOME/pictures/screenshots" +PIC="$DIR/$DATE.jpg" + +[ ! -d "$DIR" ] && mkdir -pv "$DIR" + +abort() { + notify-send -a "Warn" -i dialog-error "Screenshot" "aborted" + exit 1 +} + +notification() { + NOTIFY=$(notify-send -A open=Open -A delete=Delete -a Screenshot -i "$PIC" "Screenshot" "$PIC") + if [[ $NOTIFY == "open" ]]; then + viewnior "$PIC" + elif [[ $NOTIFY == "delete" ]]; then + rm -rf "$PIC" + else + exit 0 + fi +} + +case "$1" in + full) + flameshot full -p "$PIC" || abort + #flameshot full -p ~/pictures/screenshots + xclip -selection primary <"$PIC" + notification + ;; + crop) + flameshot gui -p "$PIC" || abort + #flameshot gui -p ~/pictures/screenshots + xclip -selection primary <"$PIC" + notification + ;; +esac |
