From: Oleg Broytman Date: Thu, 10 Jun 2021 16:43:08 +0000 (+0300) Subject: .mc/menu: View pdf with `qpdfview` X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=82270ed46376d16a9537a62edcb2d0906c0b2286;p=dotfiles.git .mc/menu: View pdf with `qpdfview` I use non-UTF8 (KOI8-R) locale but `qpdfview` no longer opens non-UTF8 paths. The menu item opens the file directly using `qpdfview` if the full path is UTF8-encoded. If not the code creates ASCII-only symlink in `~/home/tmp/` that encodes the full path in its name to make `qpdfview` store session info for the file. --- diff --git a/.mc/menu b/.mc/menu index 9ba07b1..76be469 100644 --- a/.mc/menu +++ b/.mc/menu @@ -65,10 +65,14 @@ T fb2txt v View pdf pdftotext -layout -q %f - | iconv.py -f utf-8 | ${PAGER:-more} -+= t lr & f \.(pdf|PDF)$ ++ t lr & f \.(pdf|PDF)$ e View pdf with evince evince %f & ++= t lr & f \.(pdf|PDF)$ +e View pdf with qpdfview + if [ "%d/%f" = "`echo %d/%f | iconv -t utf-8`" ]; then qpdfview %f & else src=%d/%f; dest="$HOME/tmp/`echo $src | koi2lat | sed 's!/!%!g'`"; ln -s "$src" "$dest" && qpdfview "$dest" & (sleep 3; exec rm -f "$dest") & fi + += t lr & f \.djvu(\.bz2|\.gz)?$ e View djvu djview %f &