fvwm-menu-headlines(1)

✨ fvwm-menu-headlines ✨

okay so bestie, welcome to the fvwm-menu-headlines page, straight outta the Fvwm Utilities manual (section 1, iykyk). this lil script? it builds headlines menu definitions for fvwm. that's literally the whole vibe. let's get into it πŸ’…


πŸ’– NAME πŸ’–

fvwm-menu-headlines β€” builds headlines menu definition for fvwm


🌸 SYNOPSIS 🌸

fvwm-menu-headlines [ --help|-h|-? ] [ --version|-V ] [ --info [site] ]
[ --site|-s site ] [ --name|-n name ] [ --title|-t title ] [ --item item
] [ --exec|-e exec-command ] [ --command|-e fvwm-command ] [
--icon-title icon ] [ --icon-item icon ] [ --icon-home icon ] [
--icon-error icon ] [ --wm-icons ] [ --frontpage [where] ] [ --proxy|-p
host:port ] [ --file [file] ] [ --fake [file] ] [ --timeout seconds ]

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so picture this: this configurable perl script builds an fvwm menu definition out of the headlines from all your fave news sites β€” we're talking FreshMeat, Slashdot, LinuxToday, DaemonNews, GNOME-News, KDE-News, RootPrompt, LinuxFr, ThinkGeek, CNN, BBC and more. periodt. πŸ“°βœ¨

and the way it's customisable?? you can:

  • specify your own custom menu item format
  • change the command it runs (usually it's just launching a browser, no biggie)
  • add menu icons β€” and yes bestie, there's support for the wm-icons package πŸŽ€

✨ OPTIONS ✨

  • --help β€” shows you the help and then dips, that's it, that's the whole job πŸ‘‹
  • --version β€” shows you the version and exits, cute and quick
  • --info [site] β€” if you give it a site name it prints the info for that specific site; if you don't, it prints all the site names. a little choose-your-own-adventure 🫢
  • --site site β€” define a web site, and the headlines from that site are the ones getting shown. you can also use this alongside --help to get new defaults. the default site is: freshmeat.
  • --name name β€” sets the menu name (default is "MenuHeadlinesFreshmeat")
  • --title title β€” sets the menu title (default is "Freshmeat Headlines")
  • --item label-format
  • --exec command-format β€” these two set the format for the menu item and the command (aka: what gets shown, and what gets executed when you pick the item). the default label is '%h\t%[(%Y-%m-%d %H:%M)]'. a TAB can be written as '\t', but heads up bestie β€” inside .fvwm2rc you should specify a double backslash or an actual real TAB. no cap.

Format specifiers for a headline format:

%h - headline
%u - url
%d - date in the native format (that site backend supplied)
%[strftime-argument-string] - date/time, see strftime(3)
  the date/time is represented according to the local time;
  date and/or time fields that can't be guessed are stripped
  Example: %[|%d %B %Y| %H:%M %S]
    If site supplied only date - this becomes %[|%d %B %Y|],
    if site supplied no date - this becomes an empty string.
%{name} - site specific named value, like %{comments}
%(text) - arbitrary text, good for escaping or aligning

these specifiers can also take an optional integer size β€” positive means right adjusted string, negative means left adjusted. example: %8x. and they can take an optional *num or *-num, which means "leave only the first num chars" (or the last num chars if there's a minus). the num has to be greater than 3, since the stripped part gets replaced with "...". example: %*30x. and bestie, you can combine both: %-10*-20x means grab only the last 20 characters, but if the length is less than 10, fill with up to 10 spaces on the right. the range?? πŸ’€

Example:

--exec "iceweasel -remote 'openURL(%u, new-window)' || iceweasel '%u'"
  • --command command-format β€” same energy as --exec above, but this one lets you specify any fvwm command, not just Exec. for example, "Function FuncFvwmShowURL '%u'".

fr fr, --exec="mozilla '%u'" is equivalent to --command="Exec mozilla '%u'"

  • --icon-title icon
  • --icon-item icon
  • --icon-home icon
  • --icon-error icon β€” these set the menu icon for the title, a regular item, the frontpage item and an error item respectively. default is no menu icons at all (which is the same as an empty icon argument).
  • --wm-icons β€” sets icon names that are suitable for use with the wm-icons package. currently this is equivalent to: --icon-title '' --icon-item menu/information.xpm --icon-home menu/home.xpm --icon-error menu/choice-no.xpm. iconic honestly πŸ‘‘
  • --frontpage [where] β€” adds the site frontpage item to the menu. the optional value lets you say where in the menu this item goes β€” 'top' or 't', 'bottom' or 'b'.
  • --proxy host[:port] β€” sets a proxy to use. Example: --proxy proxy.inter.net:3128
  • --file [file] β€” writes the menu output to the file you specified. if you give no filename with this option (or an empty filename), the default filename WORK_HOME/SITE.menu is used. and if you don't use this option at all, or you use a '-' filename, the menu output goes to standard output. ✨
  • --fake [file] β€” doesn't connect to the host using the HTTP protocol; instead it reads from the WORK_HOME/SITE.in file. the following reads input from freshmeat.in (downloaded from http://freshmeat.net/backend/recentnews.txt) and saves output to segfault.menu (both files are in WORK_HOME):
fvwm-menu-headlines --site freshmeat --fake --file
  • --timeout seconds β€” limits a line reading from a socket to this timeout. the default timeout is 20 seconds.

WORK_HOME for this script is ~/.fvwm/.fvwm-menu-headlines. it gets created if it's needed, don't worry bestie 🫢

option parameters can be specified either with '=' or in the next argument. short options are fine as long as they're not ambiguous: "-h", "-t". but be careful with short options, because what's unambiguous now can become ambiguous in the next versions. the more you know 🌈


πŸŽ€ USAGE πŸŽ€

  1. one of the ways to use this script is to define a crontab entry that runs the script every hour or so, for every site you're monitoring:
0,30 * * * * fvwm-menu-headlines --file --site freshmeat
1,31 * * * * fvwm-menu-headlines --file --site linuxtoday
2,32 * * * * fvwm-menu-headlines --file --site slashdot

then 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 slashdot
  1. another way to use this script (only if you have a fast network or proxy, bestie) is to run it every single time you want to open your Headlines submenus. (note: the submenu that's already been 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"
#+ I Schedule 900000 DestroyMenu $0  # reset generated menu in 15 minutes

DestroyMenu MenuHeadlines
AddToMenu   MenuHeadlines "Headlines" Title
+ MissingSubmenuFunction FuncFvwmMenuHeadlines
+ "FreshMeat"  Popup freshmeat
+ "Slashdot"   Popup slashdot
+ "LinuxToday" Popup linuxtoday
+ "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 gnome-news
+ I DestroyMenu kde-news

and finally, add "Popup MenuHeadlines" somewhere. slay πŸ’…

  1. here's the 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 newsforge --name MenuHeadlinesNewsForge"
# this may take several seconds, you may use: BusyCursor Read true
Popup MenuHeadlinesNewsForge

πŸ’œ HOW TO ADD SITE HEADLINES πŸ’œ

okay so you can totally add user-defined site headlines without touching the script itself. just put your perl extensions into the file WORK_HOME/extension.pl. for each site, add something similar to:

$site_info->{'myslashdot'} = {
  'name' => "MySlashdot",
  'host' => "myslashdot.org",
  'path' => "/myslashdot.xml",
  'func' => \&process_my_slashdot,
  # the following string is only used in --info
  'flds' => 'time, title, department, topic, author, url',
};

sub process_my_slashdot () {
  return process_xml(
    'story',
    # mandatory 'h', 'u' and 'd' aliases or undef
    { '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;

main character energy fr fr 🧚


🌟 AUTHORS 🌟

this script is inspired by WMHeadlines v1.3 by:

Jeff Meininger <jeffm@boxybutgood.com>
(http://rive.boxybutgood.com/WMHeadlines/).

reimplemented for fvwm and heavily enhanced by:

Mikhael Goikhman <migo@homemail.com>, 16 Dec 1999.

give them their flowers πŸ’


πŸ’– COPYING πŸ’–

the script is distributed by the same terms as fvwm itself. see the GNU General Public License for the details. πŸ“œ


😭 BUGS 😭

okay so the author tries to keep all supported site info up to date, but bestie β€” sites go down, they change their backend formats, they change their httpd responses, they just straight up stop posting news, and so on. the script in the latest cvs may be more up to date. it's giving chaos out here πŸ’€

also, the headline times may be off by one hour or more, since the time gets displayed for your local time zone, and the time zone of the original time in the site backend output is often guessed (sometimes incorrectly). same deal for guessing whether to apply the daylight saving correction. πŸ™ˆ

report bugs to fvwm-bug@fvwm.org.


aaand that's the whole page bestie 🫢 this was fvwm-menu-headlines from the Fvwm Utilities manual, version 2.5.28 (from cvs), dated 2009-03-22. go forth and populate those submenus, you absolute icon πŸ‘‘βœ¨