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
18 headlines of popular news web sites: FreshMeat, Slashdot, LinuxToday,
19 DaemonNews, GNOME-News, KDE-News, RootPrompt, LinuxFr, ThinkGeek, CNN,
20 BBC and more.
21
22 It is possible to specify a customized menu item format, change a
23 command (usually launching a browser) and add menu icons (there is a
24 support 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 Example:
79
80 --exec "iceweasel -remote 'openURL(%u, new-window)' || iceweasel '%u'"
81
82 --command command-format
83 like --exec above, but enables to specify any fvwm command, for
84 example, "Function FuncFvwmShowURL '%u'" not only Exec.
85
86 In fact, --exec="mozilla '%u'" is equivalent to --command="Exec
87 mozilla '%u'"
88
89 --icon-title icon
90 --icon-item icon
91 --icon-home icon
92 --icon-error icon
93 define menu icon for title, regular item, frontpage item and error
94 item respectively. Default is no menu icons (equivalent to an empty
95 icon argument).
96
97 --wm-icons
98 define icon names suitable for use with wm-icons package. Currently
99 this is equivalent to: --icon-title '' --icon-item
100 menu/information.xpm --icon-home menu/home.xpm --icon-error
101 menu/choice-no.xpm.
102
103 --frontpage [where]
104 add the site frontpage item to the menu. Optional value can be used
105 to specify where this item will be placed in the menu - 'top' or
106 't', 'bottom' or 'b'.
107
108 --proxy host[:port]
109 define a proxy to use. Example: --proxy proxy.inter.net:3128
110
111 --file [file]
112 write the menu output to specified file. If no filename is given
113 with this option (or empty filename), the default filename
114 WORK_HOME/SITE.menu is used. Without this option or with '-'
115 filename, the menu output is written to standard output.
116
117 --fake [file]
118 don't connect to the host using HTTP protocol, instead, read from
119 WORK_HOME/SITE.in file. The following reads input from freshmeat.in
120 (downloaded http://freshmeat.net/backend/recentnews.txt) and saves
121 output to segfault.menu (both files are in WORK_HOME): fvwm-menu-
122 headlines --site freshmeat --fake --file
123
124 --timeout seconds
125 limit a line reading from a socket to this timeout, the default
126 timeout is 20 seconds.
127
128 WORK_HOME of this script is ~/.fvwm/.fvwm-menu-headlines. It is created
129 if needed.
130
131 Option parameters can be specified either using '=' or in the next
132 argument. Short options are ok if not ambiguous: "-h", "-t"; but be
133 careful with short options, what is now unambiguous, can become
134 ambiguous in the next versions.
135
137 1. One of the ways to use this script is to define a crontab entry to
138 run the script every hour or so for every monitored site:
139
140 0,30 * * * * fvwm-menu-headlines --file --site freshmeat
141 1,31 * * * * fvwm-menu-headlines --file --site linuxtoday
142 2,32 * * * * fvwm-menu-headlines --file --site slashdot
143
144 Then add these lines to your fvwm configuration file:
145
146 DestroyFunc FuncFvwmMenuHeadlines
147 AddToFunc FuncFvwmMenuHeadlines
148 + I Read "$HOME/.fvwm/.fvwm-menu-headlines/$0.menu"
149
150 DestroyMenu MenuHeadlines
151 AddToMenu MenuHeadlines "Headlines" Title
152 + MissingSubmenuFunction FuncFvwmMenuHeadlines
153 + "FreshMeat" Popup freshmeat
154 + "LinuxToday" Popup linuxtoday
155 + "Slashdot" Popup slashdot
156
157 2. Another way to use this script (only if you have fast network/proxy)
158 is to run it every time you want to open your Headlines submenus.
159 (Note, the submenu that is once created is not reloaded, use "Reset
160 all".)
161
162 In this case your fvwm configuration lines could be:
163
164 DestroyFunc FuncFvwmMenuHeadlines
165 AddToFunc FuncFvwmMenuHeadlines
166 + I PipeRead "fvwm-menu-headlines --site $0"
167 #+ I Schedule 900000 DestroyMenu $0 # reset generated menu in 15 minutes
168
169 DestroyMenu MenuHeadlines
170 AddToMenu MenuHeadlines "Headlines" Title
171 + MissingSubmenuFunction FuncFvwmMenuHeadlines
172 + "FreshMeat" Popup freshmeat
173 + "Slashdot" Popup slashdot
174 + "LinuxToday" Popup linuxtoday
175 + "GNOME News" Popup gnome-news
176 + "KDE News" Popup kde-news
177 + "" Nop
178 + "Reset all" FuncResetHeadlines
179
180 DestroyFunc FuncResetHeadlines
181 AddToFunc FuncResetHeadlines
182 + I DestroyMenu freshmeat
183 + I DestroyMenu linuxtoday
184 + I DestroyMenu slashdot
185 + I DestroyMenu gnome-news
186 + I DestroyMenu kde-news
187
188 And finally, add "Popup MenuHeadlines" somewhere.
189
190 3. Here is a usual usage. Use FvwmConsole or FvwmCommand to run fvwm
191 commands from a shell script. Every time you want headlines from some
192 site, execute (give any additional options if you want):
193
194 PipeRead "fvwm-menu-headlines --site newsforge --name MenuHeadlinesNewsForge"
195 # this may take several seconds, you may use: BusyCursor Read true
196 Popup MenuHeadlinesNewsForge
197
199 It is possible to add user defined site headlines without touching the
200 script itself. Put your perl extensions to the file
201 WORK_HOME/extension.pl. For each site add something similar to:
202
203 $site_info->{'myslashdot'} = {
204 'name' => "MySlashdot",
205 'host' => "myslashdot.org",
206 'path' => "/myslashdot.xml",
207 'func' => \&process_my_slashdot,
208 # the following string is only used in --info
209 'flds' => 'time, title, department, topic, author, url',
210 };
211
212 sub process_my_slashdot () {
213 return process_xml(
214 'story',
215 # mandatory 'h', 'u' and 'd' aliases or undef
216 { 'h' => 'title', 'u' => 'url', 'd' => 'time' },
217 sub ($) { # convert 'd' string to (y, m, d, H, M, S)
218 $_[0] =~ /(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)/;
219 ($1, ($2 || 0) - 1, $3, $4, $5, $6);
220 }, +0, # timezone offset; already in UTC
221 );
222 }
223
224 1;
225
227 This script is inspired by WMHeadlines v1.3 by:
228
229 Jeff Meininger <jeffm@boxybutgood.com>
230 (http://rive.boxybutgood.com/WMHeadlines/).
231
232 Reimplemented for fvwm and heavily enhanced by:
233
234 Mikhael Goikhman <migo@homemail.com>, 16 Dec 1999.
235
237 The script is distributed by the same terms as fvwm itself. See GNU
238 General Public License for details.
239
241 I try to keep all supported site info up to date, but sites often go
242 down, change their backend formats, change their httpd responses, just
243 stop to post news and so on; the script in the latest cvs may be more
244 up to date.
245
246 The headline times may be off by one hour or more, since the time is
247 displayed for your local time zone, and the time zone of the original
248 time in the site backend output is often guessed (sometimes
249 incorrectly); similarly it is guessed whether to apply the daylight
250 saving correction.
251
252 Report bugs to fvwm-bug@fvwm.org.
253
254
255
2562.5.28 (from cvs) 2009-03-22 fvwm-menu-headlines(1)