27 lines
694 B
Bash
Executable File
27 lines
694 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
unset use_clipboard
|
|
if [[ "$1" == "-c" ]] || [[ "$1" == "--clipboard" ]]; then
|
|
use_clipboard="true"
|
|
fi
|
|
|
|
if ! $(which maim &>/dev/null); then
|
|
notify-send "[screenshot]" "missing \`maim\`"
|
|
exit 1
|
|
fi
|
|
if [[ -n "${use_clipboard}" ]] && ! $(which xclip &>/dev/null); then
|
|
notify-send "[screenshot]" "missing \`xclip\`"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -z "${use_clipboard}" ]]; then
|
|
screenshots_path="${HOME}/screenshots"
|
|
echo "${screenshots_path}"
|
|
if [[ ! -d "${screenshots_path}" ]]; then
|
|
mkdir "${screenshots_path}"
|
|
fi
|
|
maim -suo "${screenshots_path}/$(date '+%Y%m%d_%H%M%S').png"
|
|
else
|
|
maim -suo | xclip -selection clipboard -t image/png
|
|
fi
|