Mercurial > docs > unix-phil
comparison unix-phil.ms @ 36:4f2b2defbc8c
some rework and more about uzbl design (ch05)
author | meillo@marmaro.de |
---|---|
date | Tue, 30 Mar 2010 23:20:40 +0200 |
parents | f11406a85319 |
children | 9282c4cea18c |
comparison
equal
deleted
inserted
replaced
35:f11406a85319 | 36:4f2b2defbc8c |
---|---|
1 .\".if n .pl 1000i | 1 .\".if n .pl 1000i |
2 .\".nr PS 11 | 2 .nr PS 11 |
3 .\".nr VS 13 | 3 .nr VS 13 |
4 .de XX | 4 .de XX |
5 .pl 1v | 5 .pl 1v |
6 .. | 6 .. |
7 .em XX | 7 .em XX |
8 .\".nr PI 0 | 8 .\".nr PI 0 |
1203 as identified by Gancarz. | 1203 as identified by Gancarz. |
1204 | 1204 |
1205 .PP | 1205 .PP |
1206 .B "Make each program do one thing well" . | 1206 .B "Make each program do one thing well" . |
1207 Uzbl tries to be a web browser and nothing else. | 1207 Uzbl tries to be a web browser and nothing else. |
1208 The common definition of a web browser is of course highly influenced by | 1208 The common definition of a web browser is, of course, highly influenced by |
1209 existing implementations of web browsers which are degenerated. | 1209 existing implementations of web browsers, although they are degenerated. |
1210 Web browsers should be programs to browse the web, and nothing more. | 1210 Web browsers should be programs to browse the web, and nothing more. |
1211 This is the one thing they should do, as demanded by the Unix Philosophy. | 1211 This is the one thing they should do, as demanded by the Unix Philosophy. |
1212 Web browsers should not manage downloads. | 1212 .PP |
1213 Web browsers should, for instance, not manage downloads. | |
1213 This is the job download managers exist for. | 1214 This is the job download managers exist for. |
1214 Download managers do primary care about being good in downloading files. | 1215 Download managers do primary care about being good in downloading files. |
1215 Modern web browsers provide download management only as a secondary feature. | 1216 Modern web browsers provide download management only as a secondary feature. |
1216 How could they perform this job better, than programs that exist only for | 1217 How could they perform this job better, than programs that exist only for |
1217 this very job? | 1218 this very job? |
1218 And how could anyone want less than the best download manager available? | 1219 And how could anyone want less than the best download manager available? |
1219 .PP | 1220 .PP |
1220 A web browser's job is to let the user browse the web. | 1221 A web browser's job is to let the user browse the web. |
1221 This means, navigating through websites by following links. | 1222 This means, navigating through websites by following links. |
1222 Rendering the \s-1HTML\s0 sources is a different job, | 1223 Rendering the \s-1HTML\s0 sources is a different job, too. |
1223 which is covered by the webkit render engine, in uzbl's case. | 1224 It is covered by the webkit render engine, in uzbl's case. |
1224 Audio and video content and files like PostScript, \s-1PDF\s0, and the like, | 1225 Audio and video content and files like PostScript, \s-1PDF\s0, and the like, |
1225 should be handled by external applications \(en | 1226 are also not the job of a web browser. |
1226 ones that exist to handle such data. | 1227 They should be handled by external applications \(en |
1228 ones which's job is to handle such data. | |
1227 Uzbl strives to do it this way. | 1229 Uzbl strives to do it this way. |
1230 .PP | |
1231 Remember Doug McIlroy: | |
1228 .I | 1232 .I |
1229 ``Write programs that do one thing and do it well. | 1233 ``Write programs that do one thing and do it well. |
1230 Write programs to work together.'' | 1234 Write programs to work together.'' |
1231 .R | 1235 .R |
1232 .PP | 1236 .PP |
1233 The lesser tenet | 1237 The lesser tenet |
1234 .B "allow the user to tailor the environment | 1238 .B "allow the user to tailor the environment |
1235 matches good here. | 1239 matches good here. |
1236 There was the question, how anyone could want anything less than the | 1240 There was the question, how anyone could want anything less than the |
1237 best program for the job. | 1241 best program for the job. |
1238 But as personal preferences matter much, it is also important to ask: | 1242 But as personal preferences matter much, |
1243 it is probably more important to ask: | |
1239 How could anyone want something else than his preferred program for the job? | 1244 How could anyone want something else than his preferred program for the job? |
1245 .PP | |
1240 Usually users want one program for one job. | 1246 Usually users want one program for one job. |
1241 Hence, whenever the task is, for instance, downloading, | 1247 Hence, whenever the task is, for instance, downloading, |
1242 the same download manager should be used. | 1248 exactly one download manager should be used. |
1243 More advanced users might want to have this download manager in this | 1249 More advanced users might want to have this download manager in this |
1244 situation and that one in that situation. | 1250 situation and that one in that situation. |
1245 They should be able to configure it this way. | 1251 They should be able to configure it this way. |
1246 With uzbl, one can use any download manager the user wants. | 1252 With uzbl, one can use any download manager the user wants. |
1247 To switch to a different one, only one line in the small handler script | 1253 To switch to a different one, only one line in a small handler script |
1248 needs to be changed. | 1254 needs to be changed. |
1249 Alternatively it would be possible to query an environment variable | 1255 Alternatively it would be possible to query an entry in a global file |
1256 or an environment variable, which specifies the download manager to use, | |
1250 in the handler script. | 1257 in the handler script. |
1258 .PP | |
1251 As uzbl does neither have its own download manager nor depends on a | 1259 As uzbl does neither have its own download manager nor depends on a |
1252 specific one, thus uzbl's browsing abilities will not be lowered by having | 1260 specific one, thus uzbl's browsing abilities will not be lowered by having |
1253 a bad download manager. | 1261 a bad download manager. |
1262 Uzbl's download capabilities will just as good as the ones of the best | |
1263 download manager available on the system. | |
1254 Of course, this applies to all of the other supplimentary tools, too. | 1264 Of course, this applies to all of the other supplimentary tools, too. |
1255 | 1265 |
1256 .PP | 1266 .PP |
1257 .B "Use software leverage to your advantage | 1267 .B "Use software leverage to your advantage" . |
1258 and | 1268 Shell scripts are a good choice to extend uzbl. |
1259 .B "Use shell scripts to increase leverage and portability" . | 1269 Uzbl is designed to be extended by external tools. |
1270 These external tools are usually wrapped by small handler shell scripts. | |
1271 Shell scripts are the glue in this approach. | |
1272 They make the various parts fit together. | |
1273 .PP | |
1274 As an example, the history mechanism of uzbl shall be presented. | |
1275 Uzbl is configured to spawn a script to append an entry to the history | |
1276 whenever the event of a fully loaded page occurs. | |
1277 The script to append the entry to the history not much more than: | |
1278 .DS | |
1279 .CW | |
1280 #!/bin/sh | |
1281 file=/path/to/uzbl-history | |
1282 echo `date +'%Y-%m-%d %H:%M:%S'`" $6 $7" >> $file | |
1283 .DE | |
1284 \f(CW$6\fP and \f(CW$7\fP expand to the \s-1URL\s0 and the page title. | |
1285 For loading an entry, a key is bound to spawn a load from history script. | |
1286 The script reverses the history to have newer entries first, | |
1287 then displays \fIdmenu\fP to select an item, | |
1288 and afterwards writes the selected \s-1URL\s0 into uzbl's command input pipe. | |
1289 With error checking and corner cases removed, the script looks like this: | |
1290 .DS | |
1291 .CW | |
1292 #!/bin/sh | |
1293 file=/path/to/uzbl-history | |
1294 goto=`tac $file | dmenu | cut -d' ' -f 3` | |
1295 echo "uri $goto" > $4 | |
1296 .DE | |
1297 \f(CW$4\fP expands to the path of the command input pipe of the current | |
1298 uzbl instance. | |
1260 | 1299 |
1261 .PP | 1300 .PP |
1262 .B "Avoid captive user interfaces" . | 1301 .B "Avoid captive user interfaces" . |
1302 One could say, that uzbl, to a large extend, actually \fIis\fP | |
1303 a captive user interface. | |
1304 But the difference to most | |
1305 | |
1263 | 1306 |
1264 .PP | 1307 .PP |
1265 .B "Make every program a filter" . | 1308 .B "Make every program a filter" . |
1266 .B "Small is beautiful | 1309 .B "Small is beautiful |
1267 and | 1310 and |
1278 Actually, all development was community driven. | 1321 Actually, all development was community driven. |
1279 Plaetinck says: | 1322 Plaetinck says: |
1280 ``Right now I hardly code anything myself for Uzbl. | 1323 ``Right now I hardly code anything myself for Uzbl. |
1281 I just merge in other people's code, ponder a lot, and lead the discussions.'' | 1324 I just merge in other people's code, ponder a lot, and lead the discussions.'' |
1282 .[ | 1325 .[ |
1283 FIXME | 1326 %A FIXME |
1284 %O http://lwn.net/Articles/341245/ | 1327 %O http://lwn.net/Articles/341245/ |
1285 .] | 1328 .] |
1286 | 1329 |
1287 | 1330 |
1288 .NH 2 | 1331 .NH 2 |