(i3) moved screenshot function to bash script

This commit is contained in:
2026-06-26 10:03:07 +02:00
parent 1fdbf50a02
commit 85c0cd8691
2 changed files with 28 additions and 2 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/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