03-26-2024, 09:20 PM | #16 |
Groupie
Posts: 186
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
|
FBPDF - A PDF/EPUB VIEWER FOR ELINKS
***
FBPDF - A PDF/EPUB VIEWER FOR ELINKS Fbpdf is a mupdf-based pdf viewer from the same author as fbpad. $ source ~/koxtoolchain/refs/x-compile.sh kobo env bare (Prepare build system as was done in Post #4 above.) mupdf $ wget https://mupdf.com/downloads/archive/...-source.tar.gz $ tar zxvf mupdf-1.24.0-source.tar.gz $ cd mupdf-1.24.0-source/ $ make shared-clean $ make CC=arm-kobo-linux-gnueabihf-gcc CXX=arm-kobo-linux-gnueabihf-g++ OBJCOPY=arm-kobo-linux-gnueabihf-objcopy LINK=arm-kobo-linux-gnueabihf-gcc LD=arm-kobo-linux-gnueabihf-ld AR=arm-kobo-linux-gnueabihf-ar RANLIB=arm-kobo-linux-gnueabihf-ranlib XCFLAGS=" -fPIC -DTOFU_CJK -DTOFU_NOTO " HAVE_X11=no HAVE_GLUT=no shared-release $ ls -l build/shared-release/libmupdf.so.24.0 -rwxr-xr-x 1 6514576 build/shared-release/libmupdf.so.24.0 $ file build/shared-release/mutool build/shared-release/mutool: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.33, stripped $ cd .. *The next section was already done in Post #4 above: ************************************************** ** NiLuJe/FBInk https://github.com/NiLuJe/FBInk/releases $ wget https://github.com/NiLuJe/FBInk/rele...v1.25.0.tar.xz $ tar xJf FBInk-v1.25.0.tar.xz $ cd FBInk-v1.25.0/ $ make static stripped $ cd .. ddvk / fbpad-eink forked from kisonecat/fbpad-eink https://github.com/ddvk/fbpad-eink $ wget https://github.com/ddvk/fbpad-eink/a...ads/master.zip $ unzip fbpad-eink-master.zip $ cd .. ************************************************** ** aligrudi/fbpdf https://github.com/aligrudi/fbpdf $ wget https://github.com/aligrudi/fbpdf/ar...ads/master.zip $ mv master.zip fbpdf-master.zip $ unzip fbpdf-master.zip $ cd fbpdf-master/ $ cp -r ../mupdf-1.24.0-source/include . $ mkdir lib $ cp -r ../mupdf-1.24.0-source/build/shared-release/libmupdf* lib/ $ mkdir FBInk $ cp -r ../FBInk-v1.25.0/Release FBInk/ $ cp ../FBInk-v1.25.0/fbink.h FBInk/ $ cp ../fbpad-eink-master/draw.c . $ cp ../fbpad-eink-master/draw.h . $ nano -l draw.h Code:
... 19 void fbpdf_refresh(int fd, int invalid_top, int invalid_left, int invalid_right, int invalid_bottom); Code:
... 160 161 void fbpdf_refresh(int fd, int invalid_top, int invalid_left, int invalid_right, int invalid_bottom) { 162 fbink_refresh( fb_fd(), 163 invalid_top, 164 invalid_left, 165 invalid_right - invalid_left, 166 invalid_bottom - invalid_top, 167 cfg() ); 168 } *** UPDATE *** Modified space,b,r,s, and R defs. ************** $ nano -l fbpdf.c Code:
... 27 #define FBDEV "/dev/fb0" ... 43 static int percentDisplay; /* percent of display used */ 44 static int startDisplay; /* start percent of display used */ 45 static int firstRow; /* first row of display used */ 46 static int numRows; /* number of rows of display used */ ... 74 memcpy(fb_mem(i - srow + firstRow), rbuf, scols * bpp); 75 } 76 free(rbuf); 77 fbpdf_refresh(fb_fd(), firstRow, 0, scols, firstRow + srows); 78 } ... 255 switch (c) { /* commands that require redrawing */ 256 case ' ': 257 if (srow < -(int)(srows / 11)) { 258 srow += (int)(9 * srows / 10); 259 } else { 260 if (!loadpage(num + getcount(1))) 261 srow = prow; 262 } 263 break; 264 case 'b': 265 srow -= (int)(srows / 2); 266 if (srow < -prows / 2) { 267 srow = -prows / 2; 268 if (!loadpage(num - getcount(1))) 269 srow = -(int)(srows / 2); 270 } 271 break; 272 case CTRLKEY('b'): 273 case CTRLKEY('f'): 274 case 'J': 275 if (!loadpage(num + getcount(1))) 276 srow = prow; 277 break; 278 case 'K': 279 if (!loadpage(num - getcount(1))) 280 srow = prow; 281 break; 282 case 'r': 283 setmark('\''); 284 if (!loadpage(num - count)) 285 srow = prow; 286 break; 287 case 's': 288 setmark('\''); 289 if (!loadpage(num + count)) 290 srow = prow; 291 break; 292 case 'g': 293 case 'G': ... 319 case 'R': 320 rotate = getcount(0); 321 if (!loadpage(num)) 322 srow = prow; 323 break; ... 352 /* case ' ': */ ... 418 if (fb_init(FBDEV)) 419 return 1; 420 srows = fb_rows(); 421 scols = fb_cols(); 422 423 if (getenv("FBPDF_START") != NULL) { 424 printf("FBPDF_START = %s\n", getenv("FBPDF_START")); 425 startDisplay = atoi(getenv("FBPDF_START")); 426 if (startDisplay < 1 || startDisplay > 99) { 427 startDisplay = 0; 428 } 429 } else { 430 startDisplay = 0; 431 } 432 firstRow = srows * startDisplay / 100; 433 434 if (getenv("FBPDF_PERCENT") != NULL) { 435 printf("FBPDF_PERCENT = %s\n", getenv("FBPDF_PERCENT")); 436 percentDisplay = atoi(getenv("FBPDF_PERCENT")); 437 if (percentDisplay < 1 || percentDisplay > 99) { 438 percentDisplay = 100; 439 } 440 } else { 441 percentDisplay = 100; 442 } 443 if ((startDisplay + percentDisplay) > 100) { 444 percentDisplay = 100 - startDisplay; 445 } 446 numRows = srows * percentDisplay / 100; 447 448 if ((firstRow + numRows) > srows) { 449 numRows = numRows - 1; 450 } 451 srows = numRows; ... $ nano -l Makefile Code:
... 2 CC = arm-kobo-linux-gnueabihf-gcc ... 14 $(CC) -o $@ $^ $(LDFLAGS) -lmupdf -lmupdf-pkcs7 -lmupdf-threads -lm FBInk/Release/libfbink.a ... $ make fbpdf $ file fbpdf fbpdf: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.33, with debug_info, not stripped $ ls -l fbpdf -rwxr-xr-x 1 23832 fbpdf $ cd .. $ cp fbpdf-master/lib/libmupdf.so.24.0 . $ ls -l libmupdf.so.24.0 -rwxr-xr-x 1 6514576 libmupdf.so.24.0 I compressed the libmupdf.so.24.0 file: $ xz -z libmupdf.so.24.0 $ ls -l libmupdf.so.24.0.xz -rwxr-xr-x 1 3353772 libmupdf.so.24.0.xz I split up the libmupdf.so.24.0.xz file, so that it meets mobileread.com 1MB upload limit: * UPDATE - I guess upload limits were increased, or did I imagine the whole thing? Hmmm... Anyway, just unzip the one file now $ split -d -b 1000000 libmupdf.so.24.0.xz mx $ ls -l mx* -rw-r--r-- 1 1000000 mx00 -rw-r--r-- 1 1000000 mx01 -rw-r--r-- 1 1000000 mx02 -rw-r--r-- 1 353772 mx03 I added .zip extension to the split files to meet mobileread.com naming convention - didn't actually zip them) : $ mv mx00 mx00.zip $ mv mx01 mx01.zip $ mv mx02 mx02.zip $ mv mx03 mx03.zip $ ls -l mx* -rw-r--r-- 1 1000000 mx00.zip -rw-r--r-- 1 1000000 mx01.zip -rw-r--r-- 1 1000000 mx02.zip -rw-r--r-- 1 353772 mx03.zip Now to recreate the original libmupdf.so.24.0 file, you just have to reverse the process. Copy the mx*.zip files to the Kobo's /mnt/onboard/.adds/kordir/libs/ folder. On your kobo, reassemble the libmupdf.so.24.0.xz compressed file: # cd /mnt/onboard/.adds/kordir/libs/ # cat mx*.zip > libmupdf.so.24.0.xz # xz -d libmupdf.so.24.0.xz # ls -l libmupdf.so.24.0 -rwxr-xr-x 1 6514576 libmupdf.so.24.0 With libmupdf.so.24.0 installed in /mnt/onboard/.adds/kordir/libs/ folder: Copy the fbpdf binary to the Kobo's /mnt/onboard/.adds/kordir/scripts/ folder. Copy sample files fbpdf.pdf and sfm.epub, and self.png to the /mnt/onboard/.adds/kordir/ folder. # . /korenv.sh # FBPDF_PERCENT=58 fbpdf -z 20 fbpdf.pdf # FBPDF_START=29 FBPDF_PERCENT=29 fbpdf -z 20 sfm.epub # FBPDF_PERCENT=58 fbpdf -z 5 self.png space to PageDown b to PageUp j,k to scroll each page q to quit Now you can set up fbpdf as the pdf handler for elinks: Edit /mnt/onboard/.adds/kordir/.elinks/elinks.conf Code:
... set mime.extension.pdf="application/pdf" set mime.handler.pdf_viewer.unix.ask = 1 set mime.handler.pdf_viewer.unix-xwin.ask = 0 set mime.handler.pdf_viewer.unix.block = 1 set mime.handler.pdf_viewer.unix-xwin.block = 0 set mime.handler.pdf_viewer.unix.program = "/mnt/onboard/.adds/kordir/scripts/fbpdf %" set mime.handler.pdf_viewer.unix-xwin.program = "/mnt/onboard/.adds/kordir/scripts/fbpdf %" set mime.type.application.pdf = "pdf_viewer" ... # FBPDF_PERCENT=58 elinks (Hit . <RET> to browse the current folder) Navigate to a pdf file and it will open with fbpdf. e.g. 25z to zoom 2.5x h,l to scroll left,right Similarly edit /mnt/onboard/.adds/kordir/.elinks/elinks.conf to set fbpdf as an epub handler: Code:
... set mime.extension.epub="application/epub" set mime.handler.epub_viewer.unix.ask = 1 set mime.handler.epub_viewer.unix-xwin.ask = 0 set mime.handler.epub_viewer.unix.block = 1 set mime.handler.epub_viewer.unix-xwin.block = 0 set mime.handler.epub_viewer.unix.program = "/mnt/onboard/.adds/kordir/scripts/fbpdf %" set mime.handler.epub_viewer.unix-xwin.program = "/mnt/onboard/.adds/kordir/scripts/fbpdf %" set mime.type.application.epub = "epub_viewer" ... Code:
# set mime.handler.image_viewer.unix.program = "/mnt/onboard/.adds/kordir/scripts/fbink -G -y 30 -g file=% ;sleep 2" # set mime.handler.image_viewer.unix-xwin.program = "/mnt/onboard/.adds/kordir/scripts/fbink -G -y 30 -g file=% ;sleep 2" set mime.handler.image_viewer.unix.program = "/mnt/onboard/.adds/kordir/scripts/fbpdf %" set mime.handler.image_viewer.unix-xwin.program = "/mnt/onboard/.adds/kordir/scripts/fbpdf %" *** UPDATE *** Modified space,b,r,s, and R defs. ************** space now scrolls down, then next page when reaches bottom b now scrolls up, then previous page when reaches top r for rotate has been reassigned to R ESC followed by integer to reset 'count'. Then: g to goto page 'count' s to skim forward 'count' pages r to skim backward 'count' pages i to get info q to quit Included mutool and muraster utility binaries. *** ******* UPDATE2 ***** Width and css support. *********************** UPDATE2a : support ignore doc css when user css provided $ nano -l mupdf.c Code:
... 7 #define MIN_(a, b) ((a) < (b) ? (a) : (b)) 8 9 static float layout_w = FZ_DEFAULT_LAYOUT_W; 10 static float layout_h = FZ_DEFAULT_LAYOUT_H; 11 static float layout_em = FZ_DEFAULT_LAYOUT_EM; 12 static char *layout_css = NULL; 13 static int layout_use_doc_css = 1; 14 15 struct doc { ... 64 } 65 if (getenv("FBPDF_CSS") != NULL) { 66 printf("FBPDF_CSS = %s\n", getenv("FBPDF_CSS")); 67 layout_css = getenv("FBPDF_CSS"); 68 if (getenv("FBPDF_DOCCSS") != NULL) { 69 printf("FBPDF_DOCCSS = %s\n", getenv("FBPDF_DOCCSS")); 70 layout_use_doc_css = fz_atoi(getenv("FBPDF_DOCCSS")); 71 if (layout_use_doc_css != 0) 72 layout_use_doc_css = 1; 73 } 74 fz_buffer *buf = fz_read_file(doc->ctx, layout_css); 75 fz_set_user_css(doc->ctx, fz_string_from_buffer(doc->ctx, buf)); 76 fz_drop_buffer(doc->ctx, buf); 77 fz_set_use_document_css(doc->ctx, layout_use_doc_css); 78 } 79 if (getenv("FBPDF_WIDTH") != NULL) { 80 printf("FBPDF_WIDTH = %s\n", getenv("FBPDF_WIDTH")); 81 layout_w = fz_atof(getenv("FBPDF_WIDTH")); 82 if (layout_w < 50 || layout_w > 5000) { 83 layout_w = FZ_DEFAULT_LAYOUT_W; 84 } 85 } else { 86 layout_w = FZ_DEFAULT_LAYOUT_W; 87 } 88 fz_layout_document(doc->ctx, doc->pdf, layout_w, layout_h, layout_em); 89 return doc; 90 } ... $ make fbpdf Recopy the fbpdf binary to the Kobo's /mnt/onboard/.adds/kordir/scripts/ folder. Copy Style.css and sfm.epub to the /mnt/onboard/.adds/kordir/ folder. # . /korenv.sh # fbpdf -z 25 sfm.epub # FBPDF_WIDTH=420 fbpdf -z 25 sfm.epub # FBPDF_WIDTH=210 fbpdf -z 50 sfm.epub # fbpdf -z 25 sfm.epub # FBPDF_CSS=Style.css fbpdf -z 25 sfm.epub # FBPDF_CSS=Style.css FBPDF_DOCCSS=0 fbpdf -z 25 sfm.epub * SECURITY NOTE RE XZ * On desktop: $ xz -V xz (XZ Utils) 5.2.4 liblzma 5.2.4 On Kobo: # xz -v BusyBox v1.31.1.kobo (2020-04-22 11:41:43 EDT) multi-call binary. *** Last edited by elinkser; 05-09-2024 at 07:48 AM. Reason: space,b,r,s+mutool+width/css+doccss+single zip file |
03-27-2024, 04:00 PM | #17 |
Groupie
Posts: 186
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
|
SFM - A DUAL PANE FILE MANAGER FOR FBPAD
***
SFM - A DUAL PANE FILE MANAGER FOR FBPAD $ source ~/koxtoolchain/refs/x-compile.sh kobo env bare (Prepare build system as was done in Post #4 above.) afify/sfm https://github.com/afify/sfm $ wget https://github.com/afify/sfm/archive...gs/v0.4.tar.gz $ mv v0.4.tar.gz sfm-v0.4.tar.gz $ tar zxvf sfm-v0.4.tar.gz $ cd sfm-0.4/ $ nano -l config.mk Code:
... 14 CC = arm-kobo-linux-gnueabihf-gcc ... $ file sfm sfm: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.33, stripped Copy the sfm binary to the /mnt/onboard/.adds/kordir/scripts/ folder on your Kobo. # . /korenv.sh # sfm j/k to go down,up h/l to traverse directories or open file :q <RET> to quit viewing a file (vi is default viewer) space to switch panes b to open shell (CTRL-d to return to sfm) . to toggle hidden files CTRL-u to go up 3 CTRL-d to go down 3 q to quit sfm *** We can customize the keydefs to make them more consistent with our other apps. At the same time we can add fbpdf and elinks as default handlers: * Update: added PageUp/PageDown key support, removed redundant ,/. $ nano -l config.def.h Code:
... 50 /* software */ 51 static const char *mpv[] = { "mpv", "--fullscreen" }; 52 static const char *elinks[] = { "elinks" }; 53 static const char *fbpdf[] = { "fbpdf" }; ... 58 /* extensions*/ 59 static const char *images[] = { "bmp", "jpg", "jpeg", "png", "gif", "xpm" }; 60 static const char *pdf[] = { "epub", "pdf" }; 61 static const char *arts[] = { "xcf" }; 62 static const char *html[] = { "htm", "html" }; ... 69 static Rule rules[] = { 70 {videos, LEN(videos), mpv, LEN(mpv) }, 71 {images, LEN(images), fbpdf, LEN(fbpdf) }, 72 {pdf, LEN(pdf), fbpdf, LEN(fbpdf) }, 73 {documents, LEN(documents), libreoffice, LEN(libreoffice) }, 74 {arts, LEN(arts), gimp, LEN(gimp) }, 75 {html, LEN(html), elinks, LEN(elinks) }, ... 85 { {.ch = 'b'}, mv_ver, {.i = +8} }, 86 { {.key = TB_KEY_PGUP}, mv_ver, {.i = +8} }, 87 { {.key = TB_KEY_SPACE}, mv_ver, {.i = -8} }, 88 { {.key = TB_KEY_PGDN}, mv_ver, {.i = -8} }, 89 { {.ch = 'l'}, mvfwd, {.i = 0} }, 90 { {.key = TB_KEY_ARROW_RIGHT}, mvfwd, {.i = 0} }, 91 { {.key = TB_KEY_ENTER}, mvfwd, {.i = 0} }, 92 { {.ch = 'h'}, mvbk, {.i = 0} }, 93 { {.key = TB_KEY_ARROW_LEFT}, mvbk, {.i = 0} }, 94 { {.key = TB_KEY_BACKSPACE}, mvbk, {.i = 0} }, 95 { {.key = TB_KEY_BACKSPACE2}, mvbk, {.i = 0} }, ... 110 { {.ch = 'B'}, opnsh, {0} }, 111 { {.key = TB_KEY_TAB}, switch_pane, {0} }, 112 { {.key = TB_KEY_CTRL_R}, refresh, {0} }, 113 { {.ch = '\\'}, bkmrk, {.v = root} }, 114 { {.ch = 'H'}, toggle_df, {0} }, ... $ make Copy the new sfm binary to the /mnt/onboard/.adds/kordir/scripts/ folder on your Kobo. # FBPDF_PERCENT=58 sfm Our new keydefs are: j/k to go down,up (* DON'T PRESS ARROW_DOWN OR YOU WILL ENTER SHELL, CTRL-D TO EXIT) (* DON'T PRESS ARROW_LEFT OR YOU WILL BE PROMPTED TO RENAME, RET TO KEEP NAME) h/l to traverse directories or open file BS/RET to traverse directories or open file :q <RET> to quit viewing a file (vi is default viewer) TAB to switch panes B to open shell (CTRL-d to return to sfm) H to toggle hidden files b/PageUp to go up 8 space/PageDown to go down 8 q to quit sfm Now, entering l/RET on a pdf/epub/image file now invokes fbpdf, while on an html file invokes elinks. *** The vi editor is the default viewer, but we can override this with an environment variable SFM_VIEWER. * Update: at the same time we can try to correct the errant left and down arrow behavior: $ nano -l sfm.c Code:
... 1861 editor[0] = getenv("SFM_VIEWER"); ... 2000 2001 if (tb_select_input_mode(TB_INPUT_ALT) != TB_INPUT_ALT) 2002 if (tb_select_input_mode(TB_INPUT_ESC) != TB_INPUT_ESC) 2003 die("input error"); 2004 ... # SFM_VIEWER=less sfm Now, entering l/RET on a text file invokes the less pager instead of the vi editor, so you can use space/b for pagedown/pageup, and just q for quit. We can create scripts to call sfm with the viewer we want: * Update: Set TERM to linux instead of xterm to correct errant arrow key behavior. Unfortunately, same problem occurs if you press keys too quickly! But at least works if you go slow. # vi /usr/bin/sfmless Code:
export TERM=linux SFM_VIEWER=less /mnt/onboard/.adds/kordir/scripts/sfm Code:
export TERM=linux SFM_VIEWER=vi /mnt/onboard/.adds/kordir/scripts/sfm Code:
export TERM=linux SFM_VIEWER=nano /mnt/onboard/.adds/kordir/scripts/sfm # chmod 755 /usr/bin/sfmvi # chmod 755 /usr/bin/sfmnano # sfmless (can quit with q) # sfmvi (can quit with ESC then :q!) # sfmnano (haha, doesn't work unless you installed nano as in Post #3, and even then you would have to first run . /korenv.sh to set the PATH) *** Our (revised) sfm keydefs: obsoleted, see update 2 *** UPDATE ELINKS.CONF KEY BINDINGS *** Update /mnt/onboard/.adds/kordir/.elinks/elinks.conf to harmonize elinks with new apps fbpdf and sfm: REMOVE: bind "main" "," = "history-move-back" bind "main" "." = "history-move-forward" bind "main" "#" = "toggle-numbered-links" ADD: bind "main" "H" = "history-manager" bind "main" "h" = "history-move-back" bind "main" "l" = "history-move-forward" bind "main" "j" = "move-cursor-down" bind "main" "k" = "move-cursor-up" RESULT: Use H instead of h for history Use h/l instead of ,/. for move forward/back in history Use j/k for for move cursor down/up Use the default . to toggle displaying numbered links on page, so you can go directly to the link by entering the number. *************************************** *** ALSO UPDATE /KORENV.SH *** Update /korenv.sh to better work with new apps fbpdf and sfm: REMOVE: export TERM=xterm ADD: export TERM=linux export FBPDF_PERCENT=58 *************************************** *** * UPDATE 2 - A KLUDGE/FIX FOR ERRANT DIRECTION KEYS: A possible kludge/fix is to redefine key sequences to NOT be confused with the escape code sequences we are sending for the direction keys. ANSI escape code sequences for direction keys: <esc>[A - Up <esc>[B - Down <esc>[D - Left <esc>[C - Right Errant sfm direction key responses: ARROW_DOWN - SHELL ARROW_LEFT - RENAME Our latest(after 1st update) sfm keydefs: A undefined B spawn a shell in the current directory D duplicate file | directory recursively C undefined So we can try redefining these keys: A up B down D left C right , duplicate file | directory recursively S spawn a shell in the current directory . toggle dotfiles $ nano -l config.def.h Code:
... 81 { {.ch = 'j'}, mv_ver, {.i = -1} }, 82 { {.ch = 'B'}, mv_ver, {.i = -1} }, 83 { {.key = TB_KEY_ARROW_DOWN}, mv_ver, {.i = -1} }, 84 { {.ch = 'k'}, mv_ver, {.i = +1} }, 85 { {.ch = 'A'}, mv_ver, {.i = +1} }, 86 { {.key = TB_KEY_ARROW_UP}, mv_ver, {.i = +1} }, ... 91 { {.ch = 'l'}, mvfwd, {.i = 0} }, 92 { {.ch = 'C'}, mvfwd, {.i = 0} }, 93 { {.key = TB_KEY_ARROW_RIGHT}, mvfwd, {.i = 0} }, 94 { {.key = TB_KEY_ENTER}, mvfwd, {.i = 0} }, 95 { {.ch = 'h'}, mvbk, {.i = 0} }, 96 { {.ch = 'D'}, mvbk, {.i = 0} }, 97 { {.key = TB_KEY_ARROW_LEFT}, mvbk, {.i = 0} }, 98 { {.key = TB_KEY_BACKSPACE}, mvbk, {.i = 0} }, 99 { {.key = TB_KEY_BACKSPACE2}, mvbk, {.i = 0} }, ... 105 { {.ch = ','}, dupl, {0} }, ... 114 { {.ch = 'S'}, opnsh, {0} }, ... 118 { {.ch = '.'}, toggle_df, {0} }, ... $ rm config.h $ make Copy the new sfm binary to the /mnt/onboard/.adds/kordir/scripts/ folder on your Kobo. # sfm Direction keys now working, but colors in elinks a little off. Change to export TERM=screen and all good. So... # vi /usr/bin/sfmless Code:
export TERM=screen SFM_VIEWER=less /mnt/onboard/.adds/kordir/scripts/sfm Code:
export TERM=screen SFM_VIEWER=vi /mnt/onboard/.adds/kordir/scripts/sfm Code:
export TERM=screen SFM_VIEWER=nano /mnt/onboard/.adds/kordir/scripts/sfm Code:
#!/bin/sh export PATH=/mnt/onboard/.adds/kordir/scripts:/mnt/onboard/.adds/koreader/plugins/terminal.koplugin/:/mnt/onboard/.adds/koreader/scripts:$PATH export LD_LIBRARY_PATH=/mnt/onboard/.adds/kordir/libs:/mnt/onboard/.adds/koreader/libs:$LD_LIBRARY_PATH export TERM=screen export FBPDF_PERCENT=58 export HOME=/mnt/onboard/.adds/kordir/ cd $HOME alias ls='ls --color=never' * UPDATE 3 - PUT HIGHLIGHTED FILE'S BASENAME ON STATUS BAR: Helps identify currently selected file when running sfm in KOReader terminal. $ nano -l sfm.c Code:
... 284 static void 285 print_info(Pane *pane, char *dirsize) 286 { 287 char *sz, *ur, *gr, *dt, *prm, *nm; 288 289 dt = ecalloc(MAX_DTF, sizeof(char)); 290 nm = basename(CURSOR(pane).name); ... 309 print_status(cstatus, "%02d/%02d %s %s:%s %s %s %s", pane->hdir, 310 pane->dirc, prm, ur, gr, dt, sz, nm); ... Copy the new sfm binary to the /mnt/onboard/.adds/kordir/scripts/ folder on your Kobo. Run sfm in KOReader terminal: # . /korenv.sh # sfm *** Our (final?) sfm keydefs: Normal Mode q quit h/left/BS back j/down down k/up up l/right/RET open dir | file g top G bottom b/PgUp scroll up SPACE/PgDn scroll down n create new file if not exists N create new directory if not exists d delete file | directory recursively , duplicate file | directory recursively y yank p paste P move S spawn a shell in the current directory c start change cw rename co change owner and group (chown) cm change mode (chmod) cf change flags (chflags | chattr) cc exit change cq exit change . toggle dotfiles v start visual mode / start filter ENTER find filter ESC exit filter TAB switch pane ctrl+r refresh panes Visual Mode j select down k select up d delete selection v exit visual mode q exit visual mode ESC exit visual mode | change *** * Edit : actually just leave default input mode - comment out the crap I put there (it interfered with ESC key use.) $ nano -l sfm.c Code:
... 2000 /* 2001 if (tb_select_input_mode(TB_INPUT_ALT) != TB_INPUT_ALT) 2002 if (tb_select_input_mode(TB_INPUT_ESC) != TB_INPUT_ESC) 2003 die("input error"); 2004 */ ... * Edit : add a couple more bindings to elinks.conf to not interfere with screen utility. Code:
... bind "main" "Ctrl-a" = "none" bind "main" "Ctrl-A" = "none" set document.colors.use_document_colors = 0 ... Last edited by elinkser; 04-05-2024 at 09:18 PM. Reason: revised keydefs,TERM,direction,status basename,default |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
PW4 Terminal or SSH through experimental browser | SirMassive | Kindle Developer's Corner | 7 | 03-30-2021 08:51 PM |
Web Browser and BookWalker web viewer | chronoreverse | Amazon Kindle | 0 | 02-06-2019 01:44 PM |
Cannot access Calibre-Web via Kobo web browser | chakattack | Server | 14 | 08-19-2018 07:51 PM |
Kindle Fire Web Browser will likely allow for web based games. | sirmaru | Kindle Fire | 10 | 11-15-2011 02:55 PM |
merged terminal/launchpad/web server | lrizzo | Kindle Developer's Corner | 46 | 10-21-2011 05:51 PM |