dotfiles/system/.local/bin/screenshot
Severin Kaderli 2317d8cfc8
Adjust filename format for screenshots
Signed-off-by: Severin Kaderli <severin@kaderli.dev>
2020-04-01 18:27:19 +02:00

38 lines
No EOL
738 B
Bash
Executable file

#!/usr/bin/env bash
#
# SCRIPT NAME:
# screenshot
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Displays a screenshot menu using rofi.
#
# USAGE:
# ./screenshot
# The rofi prompt
PROMPT="Screenshot"
# Actions for the menu
ACTIONS=(
"1: Fullscreen"
"2: Selection"
)
FILENAME="${HOME}/pictures/screenshots/%Y-%m-%dT%H%M%S.png"
SELECTION=$(printf '%s\n' "${ACTIONS[@]}" | rofi -dmenu -i -p "${PROMPT}" | cut -d ":" -f1)
case "${SELECTION}" in
"1")
FILE=$(escrotum "${FILENAME}")
;;
"2")
FILE=$(escrotum -s "${FILENAME}")
;;
esac
# Save the screenshot also in the clipboard
TYPE=$(file -b --mime-type "${FILE}")
xclip -selection clipboard -t "${TYPE}" < "${FILE}"