1fvwm-menu-headlines(1) Fvwm Utilities fvwm-menu-headlines(1)
2
3
4
6 fvwm-menu-headlines - builds headlines menu definition for fvwm
7
9 fvwm-menu-headlines [ --help⎪-h⎪-? ] [ --version⎪-V ] [ --info [site] ]
10 [ --site⎪-s site ] [ --name⎪-n name ] [ --title⎪-t title ] [ --item
11 item ] [ --exec⎪-e exec-command ] [ --command⎪-e fvwm-command ] [
12 --icon-title icon ] [ --icon-item icon ] [ --icon-home icon ] [
13 --icon-error icon ] [ --wm-icons ] [ --frontpage [where] ] [ --proxy⎪-p
14 host:port ] [ --file [file] ] [ --fake [file] ] [ --timeout seconds ]
15
17 This configurable perl script builds an fvwm menu definition for head‐
18 lines of popular news web sites: FreshMeat, Slashdot, LinuxToday, Dae‐
19 monNews, GNOME-News, KDE-News, RootPrompt, LinuxFr, ThinkGeek, CNN, BBC
20 and more.
21
22 It is possible to specify a customized menu item format, change a com‐
23 mand (usually launching a browser) and add menu icons (there is a sup‐
24 port for the wm-icons package).
25
27 --help
28 show the help and exit
29
30 --version
31 show the version and exit
32
33 --info [site]
34 if site name is given print the site specific info, otherwise print
35 all site names
36
37 --site site
38 defile a web site, headlines of which to show, this option also can
39 be used together with --help to get new defaults. Default site:
40 freshmeat.
41
42 --name name
43 define menu name (default is "MenuHeadlinesFreshmeat")
44
45 --title title
46 define menu title (default is "Freshmeat Headlines").
47
48 --item label-format
49 --exec command-format
50 define format for menu item or command (what is shown and what is
51 executed when the item is chosen). Default label is
52 '%h\t%[(%Y-%m-%d %H:%M)]'. TAB can be specified as '\t', but in
53 .fvwm2rc you should specify a double backslash or a real TAB.
54
55 Format specifiers for a headline format:
56
57 %h - headline
58 %u - url
59 %d - date in the native format (that site backend supplied)
60 %[strftime-argument-string] - date/time, see strftime(3)
61 the date/time is represented according to the local time;
62 date and/or time fields that can't be guessed are stripped
63 Example: %[⎪%d %B %Y⎪ %H:%M %S]
64 If site supplied only date - this becomes %[⎪%d %B %Y⎪],
65 if site supplied no date - this becomes an empty string.
66 %{name} - site specific named value, like %{comments}
67 %(text) - arbitrary text, good for escaping or aligning
68
69 These specifiers can receive an optional integer size, positive for
70 right adjusted string or negative for left adjusted, example: %8x;
71 and optional *num or *-num, which means to leave only the first or
72 last (if minus) num of chars, the num must be greater than 3, since
73 the striped part is replaced with "...", example: %*30x. Both can
74 be combined: %-10*-20x, this instructs to get only the 20 last
75 characters, but if the length is less then 10 - to fill with up to
76 10 spaces on the right.
77
78 --command command-format
79 like --exec above, but enables to specify any fvwm command, for
80 example, "Function FuncFvwmShowURL '%u'" not only Exec.
81
82 In fact, --exec="mozilla '%u'" is equivalent to --command="Exec
83 mozilla '%u'"
84
85 --icon-title icon
86 --icon-item icon
87 --icon-home icon
88 --icon-error icon
89 define menu icon for title, regular item, frontpage item and error
90 item respectively. Default is no menu icons (equivalent to an empty
91 icon argument).
92
93 --wm-icons
94 define icon names suitable for use with wm-icons package. Cur‐
95 rently this is equivalent to: --icon-title '' --icon-item
96 menu/information.xpm --icon-home menu/home.xpm --icon-error
97 menu/choice-no.xpm.
98
99 --frontpage [where]
100 add the site frontpage item to the menu. Optional value can be
101 used to specify where this item will be placed in the menu - 'top'
102 or 't', 'bottom' or 'b'.
103
104 --proxy host[:port]
105 define a proxy to use. Example: --proxy proxy.inter.net:3128
106
107 --file [file]
108 write the menu output to specified file. If no filename is given
109 with this option (or empty filename), the default filename
110 WORK_HOME/SITE.menu is used. Without this option or with '-' file‐
111 name, the menu output is written to standard output.
112
113 --fake [file]
114 don't connect to the host using HTTP protocol, instead, read from
115 WORK_HOME/SITE.in file. The following reads input from freshmeat.in
116 (downloaded http://freshmeat.net/backend/recentnews.txt) and saves
117 output to segfault.menu (both files are in WORK_HOME):
118 fvwm-menu-headlines --site freshmeat --fake --file
119
120 --timeout seconds
121 limit a line reading from a socket to this timeout, the default
122 timeout is 20 seconds.
123
124 WORK_HOME of this script is ~/.fvwm/.fvwm-menu-headlines. It is cre‐
125 ated if needed.
126
127 Option parameters can be specified either using '=' or in the next
128 argument. Short options are ok if not ambiguous: "-h", "-t"; but be
129 careful with short options, what is now unambiguous, can become ambigu‐
130 ous in the next versions.
131
133 1. One of the ways to use this script is to define a crontab entry to
134 run the script every hour or so for every monitored site:
135
136 0,30 * * * * fvwm-menu-headlines --file --site freshmeat
137 1,31 * * * * fvwm-menu-headlines --file --site linuxtoday
138 2,32 * * * * fvwm-menu-headlines --file --site slashdot
139
140 Then add these lines to your fvwm configuration file:
141
142 DestroyFunc FuncFvwmMenuHeadlines
143 AddToFunc FuncFvwmMenuHeadlines
144 + I Read "$HOME/.fvwm/.fvwm-menu-headlines/$0.menu"
145
146 DestroyMenu MenuHeadlines
147 AddToMenu MenuHeadlines "Headlines" Title
148 + MissingSubmenuFunction FuncFvwmMenuHeadlines
149 + "FreshMeat" Popup freshmeat
150 + "LinuxToday" Popup linuxtoday
151 + "Slashdot" Popup slashdot
152
153 2. Another way to use this script (only if you have fast network/proxy)
154 is to run it every time you want to open your Headlines submenus.
155 (Note, the submenu that is once created is not reloaded, use "Reset
156 all".)
157
158 In this case your fvwm configuration lines could be:
159
160 DestroyFunc FuncFvwmMenuHeadlines
161 AddToFunc FuncFvwmMenuHeadlines
162 + I PipeRead "fvwm-menu-headlines --site $0"
163 #+ I Schedule 900000 DestroyMenu $0 # reset generated menu in 15 minutes
164
165 DestroyMenu MenuHeadlines
166 AddToMenu MenuHeadlines "Headlines" Title
167 + MissingSubmenuFunction FuncFvwmMenuHeadlines
168 + "FreshMeat" Popup freshmeat
169 + "Slashdot" Popup slashdot
170 + "LinuxToday" Popup linuxtoday
171 + "GNOME News" Popup gnome-news
172 + "KDE News" Popup kde-news
173 + "" Nop
174 + "Reset all" FuncResetHeadlines
175
176 DestroyFunc FuncResetHeadlines
177 AddToFunc FuncResetHeadlines
178 + I DestroyMenu freshmeat
179 + I DestroyMenu linuxtoday
180 + I DestroyMenu slashdot
181 + I DestroyMenu gnome-news
182 + I DestroyMenu kde-news
183
184 And finally, add "Popup MenuHeadlines" somewhere.
185
186 3. Here is a usual usage. Use FvwmConsole or FvwmCommand to run fvwm
187 commands from a shell script. Every time you want headlines from some
188 site, execute (give any additional options if you want):
189
190 PipeRead "fvwm-menu-headlines --site newsforge --name MenuHeadlinesNewsForge"
191 # this may take several seconds, you may use: BusyCursor Read true
192 Popup MenuHeadlinesNewsForge
193
195 It is possible to add user defined site headlines without touching the
196 script itself. Put your perl extensions to the file WORK_HOME/exten‐
197 sion.pl. For each site add something similar to:
198
199 $siteInfo->{'myslashdot'} = {
200 'name' => "MySlashdot",
201 'host' => "myslashdot.org",
202 'path' => "/myslashdot.xml",
203 'func' => \&processMySlashdot,
204 # the following string is only used in --info
205 'flds' => 'time, title, department, topic, author, url',
206 };
207
208 sub processMySlashdot () {
209 return processXml(
210 'story',
211 # mandatory 'h', 'u' and 'd' aliases or undef
212 { 'h' => 'title', 'u' => 'url', 'd' => 'time' },
213 sub ($) { # convert 'd' string to (y, m, d, H, M, S)
214 $_[0] =~ /(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)/;
215 ($1, ($2 ⎪⎪ 0) - 1, $3, $4, $5, $6);
216 }, +0, # timezone offset; already in UTC
217 );
218 }
219
220 1;
221
223 This script is inspired by WMHeadlines v1.3 by:
224
225 Jeff Meininger <jeffm@boxybutgood.com>
226 (http://rive.boxybutgood.com/WMHeadlines/).
227
228 Reimplemented for fvwm and heavily enhanced by:
229
230 Mikhael Goikhman <migo@homemail.com>, 16 Dec 1999.
231
233 The script is distributed by the same terms as fvwm itself. See GNU
234 General Public License for details.
235
237 I try to keep all supported site info up to date, but sites often go
238 down, change their backend formats, change their httpd responses, just
239 stop to post news and so on; the script in the latest cvs may be more
240 up to date.
241
242 The headline times may be off by one hour or more, since the time is
243 displayed for your local time zone, and the time zone of the original
244 time in the site backend output is often guessed (sometimes incor‐
245 rectly); similarly it is guessed whether to apply the daylight saving
246 correction.
247
248 Report bugs to fvwm-bug@fvwm.org.
249
250
251
252perl v5.8.1 2003-11-29 fvwm-menu-headlines(1)