summaryrefslogtreecommitdiff
path: root/bin/scripts/take_screenshot
diff options
context:
space:
mode:
Diffstat (limited to 'bin/scripts/take_screenshot')
-rwxr-xr-xbin/scripts/take_screenshot12
1 files changed, 12 insertions, 0 deletions
diff --git a/bin/scripts/take_screenshot b/bin/scripts/take_screenshot
new file mode 100755
index 0000000..005b702
--- /dev/null
+++ b/bin/scripts/take_screenshot
@@ -0,0 +1,12 @@
+#!/usr/bin/env sh
+
+# Grab a screenshot and save it in $XDG_DATA_HOME/screenshots
+
+screenshot_dir="${XDG_DATA_HOME:-$HOME/.local/share}/screenshots"
+[ -d "$screenshot_dir" ] || mkdir -p "$screenshot_dir"
+
+sleep 0.5 # Allow some time for dmenu or whatever to go away.
+
+filename="$(date -Iseconds -u)"
+filename="${filename%+00:00}.png"
+ffmpeg -f x11grab -i "$DISPLAY" -vframes 1 "$screenshot_dir/$filename"