Is it possible to add a custom keymap to lynx (in the config file ~/.lynxrc), which sends information (e.g. the current URL, html, title, etc.) to a shell command?
An example use case:
I am on OSX and the shell has a command open, which attempts to open anything given to it in a default fashion. So, if I am in lynx and want to move the current webpage to the default browser I would want to call open current-url from the shell.
Another:
Collating an organized bookmark file by sending URL and title to a shell script (or something else).
Using the default keymap ! opens up the default shell, but it doesn’t give me the URL nor does it run a single command and exit back to lynx as I would want for this.
Any ideas would be greatly appreciated.
I actually ended up finding a couple ways to handle this. Some are more ideal than others. It took some digging through the default configuration file.
The following are Two ways via shell command from lynx:
OPTION A: Run an shell command. Add new variable
EXTERNAL:to the/etc/lynx.cfgfile, some examples:NOTE: Lynx can only send the URL (cannot send title or any other information from the webpage without parsing a lynx dump itself)
OPTION B: Launch a browser with a custom sh script. Add new variable
PRINTER:to the/etc/lynx.cfgfile, an example:Then create a separate sh script
/Users/username/bin/openurl.shthat is called when PRINTER is triggered.There may be other ways like using the lynxified proxies:
lynxexec,lynxprog, andlynxcgi, but I was unable to successfully pass variables with these methods in my own tests.If you know a way to get title and url information from these methods I would be interested in hearing it. EXTERNAL and PRINTER methods are achieved with a single key press. Unlike print screen options which would need several keystrokes.