diff --git a/apps/file-browser.c b/apps/file-browser.c index 8cc2d288..a9571ea1 100644 --- a/apps/file-browser.c +++ b/apps/file-browser.c @@ -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"); diff --git a/apps/maybe-pdfviewer.krk b/apps/maybe-pdfviewer.krk new file mode 100644 index 00000000..b07585b2 --- /dev/null +++ b/apps/maybe-pdfviewer.krk @@ -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]) diff --git a/base/usr/share/icons/48/pdf.png b/base/usr/share/icons/48/pdf.png new file mode 100644 index 00000000..d318db64 Binary files /dev/null and b/base/usr/share/icons/48/pdf.png differ