docs/unix-phil
diff 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 |
line diff
1.1 --- a/unix-phil.ms Sat Mar 27 14:27:36 2010 +0100 1.2 +++ b/unix-phil.ms Tue Mar 30 23:20:40 2010 +0200 1.3 @@ -1,6 +1,6 @@ 1.4 .\".if n .pl 1000i 1.5 -.\".nr PS 11 1.6 -.\".nr VS 13 1.7 +.nr PS 11 1.8 +.nr VS 13 1.9 .de XX 1.10 .pl 1v 1.11 .. 1.12 @@ -1205,11 +1205,12 @@ 1.13 .PP 1.14 .B "Make each program do one thing well" . 1.15 Uzbl tries to be a web browser and nothing else. 1.16 -The common definition of a web browser is of course highly influenced by 1.17 -existing implementations of web browsers which are degenerated. 1.18 +The common definition of a web browser is, of course, highly influenced by 1.19 +existing implementations of web browsers, although they are degenerated. 1.20 Web browsers should be programs to browse the web, and nothing more. 1.21 This is the one thing they should do, as demanded by the Unix Philosophy. 1.22 -Web browsers should not manage downloads. 1.23 +.PP 1.24 +Web browsers should, for instance, not manage downloads. 1.25 This is the job download managers exist for. 1.26 Download managers do primary care about being good in downloading files. 1.27 Modern web browsers provide download management only as a secondary feature. 1.28 @@ -1219,12 +1220,15 @@ 1.29 .PP 1.30 A web browser's job is to let the user browse the web. 1.31 This means, navigating through websites by following links. 1.32 -Rendering the \s-1HTML\s0 sources is a different job, 1.33 -which is covered by the webkit render engine, in uzbl's case. 1.34 +Rendering the \s-1HTML\s0 sources is a different job, too. 1.35 +It is covered by the webkit render engine, in uzbl's case. 1.36 Audio and video content and files like PostScript, \s-1PDF\s0, and the like, 1.37 -should be handled by external applications \(en 1.38 -ones that exist to handle such data. 1.39 +are also not the job of a web browser. 1.40 +They should be handled by external applications \(en 1.41 +ones which's job is to handle such data. 1.42 Uzbl strives to do it this way. 1.43 +.PP 1.44 +Remember Doug McIlroy: 1.45 .I 1.46 ``Write programs that do one thing and do it well. 1.47 Write programs to work together.'' 1.48 @@ -1235,31 +1239,70 @@ 1.49 matches good here. 1.50 There was the question, how anyone could want anything less than the 1.51 best program for the job. 1.52 -But as personal preferences matter much, it is also important to ask: 1.53 +But as personal preferences matter much, 1.54 +it is probably more important to ask: 1.55 How could anyone want something else than his preferred program for the job? 1.56 +.PP 1.57 Usually users want one program for one job. 1.58 Hence, whenever the task is, for instance, downloading, 1.59 -the same download manager should be used. 1.60 +exactly one download manager should be used. 1.61 More advanced users might want to have this download manager in this 1.62 situation and that one in that situation. 1.63 They should be able to configure it this way. 1.64 With uzbl, one can use any download manager the user wants. 1.65 -To switch to a different one, only one line in the small handler script 1.66 +To switch to a different one, only one line in a small handler script 1.67 needs to be changed. 1.68 -Alternatively it would be possible to query an environment variable 1.69 +Alternatively it would be possible to query an entry in a global file 1.70 +or an environment variable, which specifies the download manager to use, 1.71 in the handler script. 1.72 +.PP 1.73 As uzbl does neither have its own download manager nor depends on a 1.74 specific one, thus uzbl's browsing abilities will not be lowered by having 1.75 a bad download manager. 1.76 +Uzbl's download capabilities will just as good as the ones of the best 1.77 +download manager available on the system. 1.78 Of course, this applies to all of the other supplimentary tools, too. 1.79 1.80 .PP 1.81 -.B "Use software leverage to your advantage 1.82 -and 1.83 -.B "Use shell scripts to increase leverage and portability" . 1.84 +.B "Use software leverage to your advantage" . 1.85 +Shell scripts are a good choice to extend uzbl. 1.86 +Uzbl is designed to be extended by external tools. 1.87 +These external tools are usually wrapped by small handler shell scripts. 1.88 +Shell scripts are the glue in this approach. 1.89 +They make the various parts fit together. 1.90 +.PP 1.91 +As an example, the history mechanism of uzbl shall be presented. 1.92 +Uzbl is configured to spawn a script to append an entry to the history 1.93 +whenever the event of a fully loaded page occurs. 1.94 +The script to append the entry to the history not much more than: 1.95 +.DS 1.96 +.CW 1.97 +#!/bin/sh 1.98 +file=/path/to/uzbl-history 1.99 +echo `date +'%Y-%m-%d %H:%M:%S'`" $6 $7" >> $file 1.100 +.DE 1.101 +\f(CW$6\fP and \f(CW$7\fP expand to the \s-1URL\s0 and the page title. 1.102 +For loading an entry, a key is bound to spawn a load from history script. 1.103 +The script reverses the history to have newer entries first, 1.104 +then displays \fIdmenu\fP to select an item, 1.105 +and afterwards writes the selected \s-1URL\s0 into uzbl's command input pipe. 1.106 +With error checking and corner cases removed, the script looks like this: 1.107 +.DS 1.108 +.CW 1.109 +#!/bin/sh 1.110 +file=/path/to/uzbl-history 1.111 +goto=`tac $file | dmenu | cut -d' ' -f 3` 1.112 +echo "uri $goto" > $4 1.113 +.DE 1.114 +\f(CW$4\fP expands to the path of the command input pipe of the current 1.115 +uzbl instance. 1.116 1.117 .PP 1.118 .B "Avoid captive user interfaces" . 1.119 +One could say, that uzbl, to a large extend, actually \fIis\fP 1.120 +a captive user interface. 1.121 +But the difference to most 1.122 + 1.123 1.124 .PP 1.125 .B "Make every program a filter" . 1.126 @@ -1280,7 +1323,7 @@ 1.127 ``Right now I hardly code anything myself for Uzbl. 1.128 I just merge in other people's code, ponder a lot, and lead the discussions.'' 1.129 .[ 1.130 -FIXME 1.131 +%A FIXME 1.132 %O http://lwn.net/Articles/341245/ 1.133 .] 1.134