Monday, January 19, 2009


As you may have figured out by now, I created a master script for handling pdf files when in text consoles. I've put this up at There are probably many improvements that can be made to this but it provides a simple way to attack pdf files.

firefox -new-tab ......

I used to use one of my 26 bookmark files of Lynx to pass URLs from web browseing in Lynx to Firefox. I had that particular file bookmarked by Firefox, and could simply bookmark a url to the "F" bookmarkfile from Lynx, then when I swapped to Firefox pull up that file from Firefox's bookmarks, then seek out the particular URL in question. I thought that was pretty slick, saving a lot of scratch paper moving the URL from a text console to GUI environment, but I've since done better.

Looking over the man page for Firefox, I found there was provision for sending URL's to already running instances of 'fox. After a bit of experimentation, I found that this could be done from text consoles, and was not restricted to being issued from the GUI environment. With this information, I added these lines to my Lynx externals in /etc/lynx-cur/lynx.cfg:

EXTERNAL:http:firefox -new-tab %s --display=\:0.0 ; sudo chvt 11 :TRUE

EXTERNAL:http:firefox -new-window %s --display=\:0.0 ; sudo chvt 11 :TRUE

The '-new-tab' and '-new-window' switches are pretty self explanatory. --display tells which X display to use, which could is theory be more complex than most people use. It should be pointed out that it was necessary to escape the colons with this parameter so as not to confuse Lynx. The part starting with 'sudo ...' might be unfamiliar to some. chvt is a command to switch to other virtual consoles. Currently it seems to be limited to those setup by inittab or it's equivalent, and requires root privilages to function. I've sudo configured to run it without needing any password. Anyway, one curious thing is that it can switch you to your GUI, which in my case is console 11 - you'd need to adjust it to your situation, usually console 7.

I'm putting this article in my series on handling pdf files in text consoles because you can use this to pass the location of a file to Firefox from a console and let it handle the file however you have Firefox configured to. The fact of the matter is though that almost any thing can easily be passed from Lynx to Firefox this way not just pdf files. This has accessability implications in that someone who may out of neccessity use Lynx can with this use Firefox as a simplified interface to running various media types in the GUI environment. They could have their GUI configured to automaticly launch FireFox when it starts, and perhaps set things up so that when finished the switch back to the console and restart X rather than bother trying to navigate the GUI. This is pretty crude, but it might serve their needs. One complication might be the need to locate a start button, such as sites like YouTube have, but perhaps even this might be overcome. Anyway only the future will tell.

5) with fbgs / Investigating fbi

When I started this series of articles on handling pdf in text consoles, I had a different computer, using different tools for video content in consoles. Since then I've started using a frame buffer, and a tool for using a frame buffer to view .pdf's, fbgs came to my attention. fbgs is actually a script to glue actions by ghostscript and fbi, "Frame Buffer Imageviewer" together. fbgs accepts most of the flags for fbi, and a few of it's own. The most significant of it's own, to me, seems to be '-c', to render in color. fbi itself is a fairly straightforward tool, the most important command when using it being 'h', to toggle the help display on/off. Once you've got the help displayed, you can do most anything with it. fbi seems to be more minimalist oriented where the svgalib using zgv imageviewer is a 'kitchen sink' tool, loaded with features. zgv can be compiled with sdl, "Simple DirectMedia Layer" support instead of straight svgalib, so that it can use framebuffer images display, but I haven't done that yet, and it is another story.