35 lines
752 B
Bash
Executable File
35 lines
752 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# GIGACHAD image viewer script
|
|
# Usage: img [directory]
|
|
|
|
# Set default directory to current if none provided
|
|
dir="${1:-.}"
|
|
|
|
# Check if sxiv is installed
|
|
if ! command -v sxiv >/dev/null 2>&1; then
|
|
echo "ERROR: sxiv not found. Install this gigachad viewer first!" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Verify the directory exists
|
|
if [ ! -d "$dir" ]; then
|
|
echo "ERROR: Directory '$dir' not found" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Find images (common extensions) and pass to sxiv
|
|
find "$dir" -maxdepth 1 -type f \( \
|
|
-iname "*.jpg" -o \
|
|
-iname "*.jpeg" -o \
|
|
-iname "*.png" -o \
|
|
-iname "*.gif" -o \
|
|
-iname "*.bmp" -o \
|
|
-iname "*.tif" -o \
|
|
-iname "*.tiff" -o \
|
|
-iname "*.svg" -o \
|
|
-iname "*.webp" \
|
|
\) | sort | sxiv -i -f -
|
|
|
|
exit 0
|