Adjust screenshot script for Wayland

Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
Severin Kaderli 2022-01-09 18:46:19 +01:00
parent 0b655edfbe
commit b313e1ba77
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4
2 changed files with 5 additions and 8 deletions

View file

@ -44,6 +44,7 @@ bindsym $SUPER+Return exec kitty
# Kill focused window
bindsym $SUPER+Shift+Q kill
bindsym Print exec screenshot
floating_modifier $SUPER normal

View file

@ -21,18 +21,14 @@ ACTIONS=(
"2: Selection"
)
FILENAME="${HOME}/pictures/screenshots/%Y-%m-%dT%H%M%S.png"
FILENAME="$(xdg-user-dir PICTURES)/screenshots/$(date +'%Y-%m-%dT%H%M%S').png"
SELECTION=$(printf '%s\n' "${ACTIONS[@]}" | rofi -dmenu -i -p "${PROMPT}" | cut -d ":" -f1)
SELECTION=$(printf '%s\n' "${ACTIONS[@]}" | fuzzel -dmenu -I| cut -d ":" -f1)
case "${SELECTION}" in
"1")
FILE=$(escrotum "${FILENAME}")
grim - | tee "${FILENAME}" | wl-copy
;;
"2")
FILE=$(escrotum -s "${FILENAME}")
grim -g "$(slurp)" - | tee "${FILENAME}" | wl-copy
;;
esac
# Save the screenshot also in the clipboard
TYPE=$(file -b --mime-type "${FILE}")
xclip -selection clipboard -t "${TYPE}" < "${FILE}"