auto up 23:30:04 up 4:52, 2 users, load average: 0.32, 0.27, 0.33

This commit is contained in:
2025-11-05 23:30:05 +01:00
parent 2685fa6afe
commit 926210ffc0

View File

@@ -1,14 +1,19 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Directory to search (default: current directory or given argument) # Directories to search (default: current directory if none provided)
SEARCH_DIR="${1:-.}" SEARCH_DIRS=("${@:-.}")
# Your preferred PDF viewer (adjust as needed) # Your preferred PDF viewer
PDF_VIEWER="zathura" PDF_VIEWER="zathura"
# Ensure fzf and the viewer exist # Ensure fzf and the viewer exist
command -v fzf >/dev/null 2>&1 || { echo "fzf not found"; exit 1; } command -v fzf >/dev/null 2>&1 || { echo "fzf not found"; exit 1; }
command -v "$PDF_VIEWER" >/dev/null 2>&1 || { echo "$PDF_VIEWER not found"; exit 1; } command -v "$PDF_VIEWER" >/dev/null 2>&1 || { echo "$PDF_VIEWER not found"; exit 1; }
# Find all PDFs recursively and feed them to fzf in a loop # Find all PDFs recursively, sorted by modification time (newest first)
find "$SEARCH_DIR" -type f -iname '*.pdf' | sort | fzf --multi --bind "enter:execute-silent($PDF_VIEWER {} &)" --preview "pdftotext {} - | head -n 20" --preview-window=down:wrap find "${SEARCH_DIRS[@]}" -type f -iname '*.pdf' -printf '%T@ %p\n' | \
sort -nr | cut -d' ' -f2- | \
fzf --multi \
--bind "enter:execute-silent($PDF_VIEWER {} &)" \
--preview "pdftotext {} - | head -n 20" \
--preview-window=down:wrap