It is possible to specify a customized menu item format, change a command (usually launching a browser) and add menu icons (there is a support for the wm-icons package).
---version - show the version and exit
---info [site] - if site name is given print the site specific info, otherwise print all site names
---site site - defile a web site, headlines of which to show, this option also can be used together with --help to get new defaults. Default site: freshmeat.
---name, ---title, ---icon - define menu
---name, ---title, ---icon - define menu name, menu title and menu icon accordingly given in the following name, menu title and menu icon accordingly given in the following argument. Default is name ``MenuHeadlinesFreshmeat'', title argument. Default is name ``MenuHeadlinesFreshmeat'', title ``Freshmeat Headlines'' and no mini-icon (equivalent to an empty icon argument).
---item, ---exec - define menu item or exec format in the following argument (what is shown and what is executed when the item is chosen), default is '%h\t(%[%Y-%m-%d %H:%M])'. TAB can be specified as '\t', but in fvwmrc you should specify a double backslash or a real TAB.
Format specifiers for a headline entry: %h - headline %u - url %d - date in native format %[strftime-argument-string] - date, see (3) the date is represented accourding to the local time %{name} - site-specific-named-value %(text) - arbitrary text
These specifiers can receive an optional integer size, positive for right adjusted string or negative for left adjusted, example: %8x; and optional *num or *-num, which means to leave only the first or last (if minus) num of chars, the num must be greater than 3, since the striped part is replaced with ``...'', example: %*30x. Both can be combined: %-10*-20x, this instructs to get only the 20 last characters, but if the length is less then 10 - to fill with up to 10 spaces on the right.
---command like ---exec above, but enables to specify any fvwm command, for example, ``Function FuncFvwmShowURL '%u''' not only Exec.
In fact, --exec=``mozilla '%u''' is equivalent to --command=``Exec mozilla '%u'''
---icon-title, ---icon-item, ---icon-home -
---icon-title, ---icon-item, ---icon-home - define menu icon for title, regular item and home item respectively define menu icon for title, regular item and home item respectively given in the following argument. Default is no menu icons (equivalent to an empty icon argument).
---wm-icons - define icon names suitable for use with wm-icons package. Currently this is equivalent to: --icon-title '' wm-icons package. Currently this is equivalent to: --icon-title '' --icon-item menu/information.xpm --icon-home menu/home.xpm.
---frontpage [where] - show site fronpage item in the menu too. Optional value can be used to specify where this item will be placed in the menu - 'top' or 't', 'bottom' or 'b'.
---proxy host[:port] - define a proxy to use. Example: --proxy proxy.inter.net:3128
---file [file] - write the menu output to specified file. If no filename is given with this option (or empty filename), the default filename WORK_HOME/SITE.menu is used. Without this option or with '-' filename, the menu output is written to standard output.
---fake [file] - don't connect to the host using HTTP protocol, instead, read from WORK_HOME/SITE.in file. The following reads input from segfault.in (downloaded http://segfault.org/stories.txt) and saves output to segfault.menu (both files are in WORK_HOME): fvwm-menu-headlines --site segfault --fake --file
WORK_HOME of this script is ~/.fvwm/.fvwm-menu-headlines. It is created if needed.
Option parameters can be specified both using '=' and in the next argument. Short options are ok if not ambiguous: `-h', `-t'; but be careful with short options, what is now unambiguous, can become ambiguous in the next versions.
0,30 * * * * fvwm-menu-headlines --file --site freshmeat 1,31 * * * * fvwm-menu-headlines --file --site linuxtoday 2,32 * * * * fvwm-menu-headlines --file --site slashdotThen add these lines to your fvwm configuration file:
DestroyFunc FuncFvwmMenuHeadlines AddToFunc FuncFvwmMenuHeadlines + I Read "$HOME/.fvwm/.fvwm-menu-headlines/$0.menu" DestroyMenu MenuHeadlines AddToMenu MenuHeadlines "Headlines" Title + MissingSubmenuFunction FuncFvwmMenuHeadlines + "FreshMeat" Popup freshmeat + "LinuxToday" Popup linuxtoday + "Slashdot" Popup slashdot2. Another way to use this script (only if you have fast network/proxy) is to run it every time you want to open your Headlines submenus. (Note, the submenu that is once created is not reloaded, use ``Reset all''.)
In this case your fvwm configuration lines could be:
DestroyFunc FuncFvwmMenuHeadlines AddToFunc FuncFvwmMenuHeadlines + I PipeRead "fvwm-menu-headlines --site $0" DestroyMenu MenuHeadlines AddToMenu MenuHeadlines "Headlines" Title + MissingSubmenuFunction FuncFvwmMenuHeadlines + "FreshMeat" Popup freshmeat + "Slashdot" Popup slashdot + "LinuxToday" Popup linuxtoday + "Segfault" Popup segfault + "AppWatch" Popup appwatch + "GNOME News" Popup gnome-news + "KDE News" Popup kde-news + "" Nop + "Reset all" FuncResetHeadlines DestroyFunc FuncResetHeadlines AddToFunc FuncResetHeadlines + I DestroyMenu freshmeat + I DestroyMenu linuxtoday + I DestroyMenu slashdot + I DestroyMenu segfault + I DestroyMenu appwatch + I DestroyMenu gnome-news + I DestroyMenu kde-newsAnd finally, add ``Popup MenuHeadlines'' somewhere.
3. Here is a usual usage. Use FvwmConsole or FvwmCommand to run fvwm commands from a shell script. Every time you want headlines from some site, execute (give any additional options if you want):
PipeRead "fvwm-menu-headlines --site segfault --name MenuHeadlinesSegfault" # this will take several seconds, you may use: BusyCursor Read true Popup MenuHeadlinesSegfault
$siteInfo->{'myslashdot'} = {
'name' => "MySlashdot",
'host' => "myslashdot.org",
'path' => "/myslashdot.xml",
'func' => \&processMySlashdot,
# the following string is only used in --info
'flds' => 'time, title, department, topic, author, url',
'flds' => 'time, title, department, topic, author, url',
};
sub processMySlashdot () {
return processXml(
'story',
# mandatory 'h', 'u' and 'd' aliases or undef
{ 'h' => 'title', 'u' => 'url', 'd' => 'time' },
{ 'h' => 'title', 'u' => 'url', 'd' => 'time' },
sub ($) { # convert 'd' string to (y, m, d, H, M, S)
$_[0] =~ /(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)/;
($1, ($2 || 0) - 1, $3, $4, $5, $6);
}, +0, # timezone offset; already in UTC
);
}
1;
Jeff Meininger <jeffm@boxybutgood.com> ( Reimplemented for FVWM and heavily enhanced by:Mikhael Goikhman <COPYING
The script is distributed by the same terms as fvwm itself. See GNU General Public License for details.BUGS
Report bugs to fvwm-bug@fvwm.org.