Add a module for copying camera images
This commit is contained in:
parent
cc9cf1f360
commit
5156d7a617
1 changed files with 34 additions and 0 deletions
34
q-cam
Executable file
34
q-cam
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
CAMERA_DIR=~/Camera
|
||||||
|
|
||||||
|
if [[ -z "$@" ]]; then
|
||||||
|
echo "^cam .*$"
|
||||||
|
elif [[ "$1" == "--hint" ]]; then
|
||||||
|
shift
|
||||||
|
elif [[ "$1" == "--complete" ]]; then
|
||||||
|
shift
|
||||||
|
if [[ -d "$CAMERA_DIR" ]]; then
|
||||||
|
ls "$CAMERA_DIR" | awk '{print $1 " cam " $1}'
|
||||||
|
fi
|
||||||
|
elif [[ "$1" == "--preview" ]]; then
|
||||||
|
shift
|
||||||
|
|
||||||
|
FILE="$CAMERA_DIR/$1"
|
||||||
|
TYPE=$(file --dereference --mime -- "$FILE")
|
||||||
|
|
||||||
|
if [[ $TYPE =~ image/ ]]; then
|
||||||
|
DIM=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}
|
||||||
|
chafa -s "$DIM" "$FILE"
|
||||||
|
# Add a new line character so that fzf can display multiple images in the preview window
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$FILE"
|
||||||
|
|
||||||
|
elif [[ "$1" == "--run" ]]; then
|
||||||
|
shift
|
||||||
|
setsid -f wl-copy < "$CAMERA_DIR/$1"
|
||||||
|
else
|
||||||
|
echo "Unexpected arguments: $@"
|
||||||
|
fi
|
Loading…
Reference in a new issue