file-browser: Icons, identification of PDFs, little launcher wrapper

This commit is contained in:
K. Lange 2021-10-08 10:22:33 +09:00
parent 8d029531f8
commit 9ad23299c7
3 changed files with 15 additions and 0 deletions

View File

@ -667,6 +667,10 @@ static void load_directory(const char * path, int modifies_history) {
sprintf(f->icon, "font");
sprintf(f->launcher,"exec font-preview");
sprintf(f->filetype, "TrueType Font");
} else if (has_extension(f, ".pdf")) {
sprintf(f->icon, "pdf");
sprintf(f->launcher,"exec maybe-pdfviewer.krk");
sprintf(f->filetype, "Portable Document Format");
} else if (has_extension(f, ".tgz") || has_extension(f, ".tar.gz")) {
sprintf(f->icon, "package_targz");
sprintf(f->filetype, "Compressed Archive File");

11
apps/maybe-pdfviewer.krk Normal file
View File

@ -0,0 +1,11 @@
#!/bin/kuroko
import os
import kuroko
try:
os.stat('/usr/bin/pdfviewer')
os.execl('/usr/bin/pdfviewer','pdfviewer',kuroko.argv[1])
except os.OSError:
if os.system('showdialog "PDF Viewer" "/usr/share/icons/48/pdf.png" "Do you want to install the PDF viewer from the Package Manager?"') == 0:
os.system('terminal gsudo sh -c "msk update; msk install mupdf"')
os.execl('/usr/bin/pdfviewer','pdfviewer',kuroko.argv[1])

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB