From 82270ed46376d16a9537a62edcb2d0906c0b2286 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Thu, 10 Jun 2021 19:43:08 +0300 Subject: [PATCH] .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. --- .mc/menu | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 & -- 2.39.5