Merge 20c16d980f3977609e1b2c04e2ea19dab638ecfc into f853f1884a8f0c244765192dc6f5a910a7e2b8e5

This commit is contained in:
Emre AKYÜZ 2025-04-23 06:29:59 +00:00 committed by GitHub
commit 1fa882d0ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

17
.local/bin/searchfiles Normal file
View File

@ -0,0 +1,17 @@
#!/bin/dash
p() { printf "%s\n" "${@}"; }
d() { dmenu -l "15" -p "${1}"; }
f() {
r="$(locate -b -e --regex -d "${XDG_CONFIG_HOME}/.p.db" "(${1})$")"
o="$(p "${r}" | sed 's|.*/||; s/\.[^.]*$//' | d "${c}")"
[ "${o}" ] && ${2} "$(p "${r}" | grep -Fm "1" "/${o}.")"
}
c="$(p "Doc" "Image" "Music" "Office" "Video" | d "Categories")"
case "${c}" in
"Doc") f "cb.|djvu|epup|mobi|p(df|s)" "zathura --mode fullscreen" ;;
"Image") f "j(pe?g|xl)|png|webp" "nsxiv -bfq" ;;
"Music") f "flac|m(p3|4a)|o(gg|pus)|wav" "mpv" ;;
"Office") f "(doc|ppt|xls)x?|od(p|s)" "libreoffice" ;;
"Video") f "avi|flv|gif|m(2ts|p4)|m(4|o|k)v|w(ebm|mv)" "mpv" ;;
*) exit ;;
esac