commit c16a704173321d87bdcc55af2a4abf36eb84f8e6
parent 28547ac05e95683859a01a025f5e90c9fd9bff21
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Sat, 13 Feb 2021 13:47:01 -0800
Simplify snap script
Since ffcast(1) is not available on OpenBSD and maim(1) does
everything by itself, arguments are passed as is to maim(1).
- Rename SCREENSHOT_DIR to SNAP_DIR aswell as update the path
- Images are written to the `PREFIX/%F/%H.%M.%S.ff' strftime(3)
format string
- Add copywrite and license notices
- Use the `/bin/sh' shebang instead of `/usr/bin/env dash'
- Images are saved in the farbfeld(5) format.
Diffstat:
2 files changed, 11 insertions(+), 26 deletions(-)
diff --git a/modules/profile/.profile b/modules/profile/.profile
@@ -19,7 +19,7 @@ export PASSWORD_STORE_DIR="$HOME/.local/var/pass/"
export DICT_DIR="$HOME/.local/share/wdef/"
export FEED_DIR="$HOME/.local/var/rss/"
export PWDLOG="$HOME/.local/var/log/pwd"
-export SCREENSHOT_DIR="$HOME/own/image/screenshots/"
+export SNAP_DIR="$HOME/own/graphics/bitmap/screenshots/"
export THESAURUS_DIR="$HOME/.local/share/walt/"
export URL_DIR="$HOME/.local/var/bookmarks/"
export WALLPAPER_DIR="$HOME/image/wallpapers/"
diff --git a/modules/scripts/.local/bin/snap b/modules/scripts/.local/bin/snap
@@ -1,25 +1,10 @@
-#!/usr/bin/env dash
-#! snap -- take a snapshot of the screen
-
-set -e
-
-# output
-path="$SCREENSHOT/`date +%Y%m%d-%H%M%S`.png"
-
-# display usage
-usage()
-{
- echo "usage, `basename $0` [-fsw]"
- echo "\t-f, select everything"
- echo "\t-s, select region"
- echo "\t-w, select window"
- echo "\t-h, display usage and exit"
-}
-
-case ${1:-"-f"} in
- -f) imlib2_grab "$path";;
- -s) ffcast -s png "$path";;
- -w) ffcast -w png "$path";;
- -h) usage; exit;;
- *) echo "error: invalid argument" 1>&2; exit 2;;
-esac
+#!/bin/sh
+# Copywrite 2021 Jacob R. Edwards
+# License: GPLv3
+#
+# snap -- screenshot to dated file
+#
+# As it's merely a wrapper around maim(1) it's usage is the same.
+
+path="${SNAP_DIR-.}/`date +%F/%H.%M.%S`.ff"
+mkdir -p `dirname $path` && maim $* -f png | png2ff >$path && echo $path