From 9ad23299c76bf12cf08c866a571c70251291cd31 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Fri, 8 Oct 2021 10:22:33 +0900 Subject: [PATCH] file-browser: Icons, identification of PDFs, little launcher wrapper --- apps/file-browser.c | 4 ++++ apps/maybe-pdfviewer.krk | 11 +++++++++++ base/usr/share/icons/48/pdf.png | Bin 0 -> 1723 bytes 3 files changed, 15 insertions(+) create mode 100644 apps/maybe-pdfviewer.krk create mode 100644 base/usr/share/icons/48/pdf.png 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 0000000000000000000000000000000000000000..d318db644e86315c8d2564896a1caa0b7009dd08 GIT binary patch literal 1723 zcmV;s21NOZP)m5%8l!{O&M0Uc{xMt83y8Dumbtym~jkdqTk8y?ZBIuW1_l z_U)V0whT6uZ?-~l1XUA{aUp}ZBKS5#n0i6#W8Q>O@s zo0DBd2yDafGE^Qs^TRW|8RxF;5fL30PZ^;tM6a@vS zQf?l8Tv71X)p;2zkLTCGyv>_QI}Qsq4Hd{qNnrVM)Ih-NP{1tAg%)hx%4OT8S=Rx$ zX4^clW{oFvq!|mC4mB+;j0J-@ZUV!OL;c2$UWdu!xqy+AC#e`4LvcIMh~qGK?OLzH zpF>p2T7eeET0)*pr$>5wvE%Xl-FMKkSo7kG2u-7>wUtLzmGRzQjz9MtWuXveCWD>HU|zqD zoz0?_l@SbwnYVc};isQQb&pdr0lywRNRxZ^(~g4`3XzJ(8Sd%9_WL=XPV=zO#~;1D zXnlQXLLdPL@Bx|-jP>`E{PIgKe)JKKfA$#!gWd?3YB)0k1B`z475{K=UJ1)W4i1vq zvxizmp+N|;s>*Mc#e78}<2b|(0}%*NxojDZWs$pdiLhm{!slb)+&O-U#aQ>w)Q^Y$ z@8^B7p{ibZ2%H_+w6Hr(}xnzJ8VpjiY85M6ThXhkycLi2XkG$A-|n$&l8Qv1Xc zv+}QNGK%U#10R1(V>Zj6ZKFN;B#Nfdm`*cSRT;KzMi(t&#T#$TcCHgr)Ci0v64WUQ zmrWDvn{NnbvplHlTyq@G1%v#vyBnp*JEzwaH3D^;Hu1Y<@u<(oI>Vq*RY_PDKUY=p z*r7wrS-iL;PpxMxAhc~8Wjl6o!nWx(436tM#*z8b|@xf$^CLz)eDPll2uOt-7Z0|A`k`A#wt93e0xxmKekRwcPC!@;}+9dp@W_ R