Merge lp:~jamesodhunt/byobu/unicode-enhancements into lp:byobu
- unicode-enhancements
- Merge into trunk
Proposed by
James Hunt
Status: | Merged |
---|---|
Merged at revision: | 1297 |
Proposed branch: | lp:~jamesodhunt/byobu/unicode-enhancements |
Merge into: | lp:byobu |
Diff against target: |
978 lines (+921/-2) 7 files modified
debian/changelog (+13/-0) usr/lib/byobu/Makefile.am (+1/-1) usr/lib/byobu/uclock (+173/-0) usr/lib/byobu/ugraph (+212/-0) usr/lib/byobu/ulevel (+481/-0) usr/lib/byobu/wastebasket (+39/-0) usr/lib/byobu/wifi_quality (+2/-1) |
To merge this branch: | bzr merge lp:~jamesodhunt/byobu/unicode-enhancements |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Dustin Kirkland | Pending | ||
Review via email: mp+48561@code.launchpad.net |
Commit message
Description of the change
[ James Hunt <email address hidden> ]
* usr/lib/
(requires bash) (LP: #705037).
* usr/lib/
ulevel data (required bash).
* usr/lib/
some 'level' using various unicode characters (requires bash)
(LP: #705032).
* usr/lib/
contents of wastebasket.
* usr/lib/
Hi Dustin - lots of updates to the unicode notifications. You can now pass floating point values. I've got some test scripts that could be added at a later stage maybe?
Cheers,
James.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2011-02-01 19:24:03 +0000 | |||
3 | +++ debian/changelog 2011-02-03 23:10:35 +0000 | |||
4 | @@ -1,9 +1,22 @@ | |||
5 | 1 | byobu (3.28) unreleased; urgency=low | 1 | byobu (3.28) unreleased; urgency=low |
6 | 2 | 2 | ||
7 | 3 | [ Dustin Kirkland ] | ||
8 | 3 | * usr/lib/byobu/wifi_quality: don't show wifi-quality if connectivity == 0 | 4 | * usr/lib/byobu/wifi_quality: don't show wifi-quality if connectivity == 0 |
9 | 4 | * usr/lib/byobu/disk_io: don't show disk_io if rate = 0 | 5 | * usr/lib/byobu/disk_io: don't show disk_io if rate = 0 |
10 | 5 | * usr/lib/byobu/services: finally fix that nagging, mysterious whitespace | 6 | * usr/lib/byobu/services: finally fix that nagging, mysterious whitespace |
11 | 6 | 7 | ||
12 | 8 | [ James Hunt <james.hunt@ubuntu.com> ] | ||
13 | 9 | * usr/lib/byobu/uclock: New UTF-8 notification showing time in binary | ||
14 | 10 | (requires bash) (LP: #705037). | ||
15 | 11 | * usr/lib/byobu/ugraph: New UTF-8 notification utility showing historical | ||
16 | 12 | ulevel data (required bash). | ||
17 | 13 | * usr/lib/byobu/ulevel: New UTF-8 notification utility which displays | ||
18 | 14 | some 'level' using various unicode characters (requires bash) | ||
19 | 15 | (LP: #705032). | ||
20 | 16 | * usr/lib/byobu/wastebasket: New ASCII+UTF-8 notification indicating | ||
21 | 17 | contents of wastebasket. | ||
22 | 18 | * usr/lib/byobu/wifi_quality: added UTF-8 icon. | ||
23 | 19 | |||
24 | 7 | -- Dustin Kirkland <kirkland@ubuntu.com> Fri, 28 Jan 2011 17:12:27 -0600 | 20 | -- Dustin Kirkland <kirkland@ubuntu.com> Fri, 28 Jan 2011 17:12:27 -0600 |
25 | 8 | 21 | ||
26 | 9 | byobu (3.27-0ubuntu1) natty; urgency=low | 22 | byobu (3.27-0ubuntu1) natty; urgency=low |
27 | 10 | 23 | ||
28 | === modified file 'usr/lib/byobu/Makefile.am' | |||
29 | --- usr/lib/byobu/Makefile.am 2010-11-19 02:43:19 +0000 | |||
30 | +++ usr/lib/byobu/Makefile.am 2011-02-03 23:10:35 +0000 | |||
31 | @@ -1,3 +1,3 @@ | |||
32 | 1 | libdirdir = $(prefix)/lib/@PACKAGE@ | 1 | libdirdir = $(prefix)/lib/@PACKAGE@ |
34 | 2 | libdir_SCRIPTS = apport arch battery cpu_count cpu_freq cpu_temp custom date disk disk_io ec2_cost fan_speed hostname ip_address load_average logo mail mem_available mem_used menu network .notify_osd notify_osd processes raid rcs_cost reboot_required release services swap time time_utc updates_available uptime users whoami wifi_quality | 2 | libdir_SCRIPTS = apport arch battery cpu_count cpu_freq cpu_temp custom date disk disk_io ec2_cost fan_speed hostname ip_address load_average logo mail mem_available mem_used menu network .notify_osd notify_osd processes raid rcs_cost reboot_required release services swap time time_utc uclock ugraph ulevel updates_available uptime users wastebasket whoami wifi_quality |
35 | 3 | 3 | ||
36 | 4 | 4 | ||
37 | === added file 'usr/lib/byobu/uclock' | |||
38 | --- usr/lib/byobu/uclock 1970-01-01 00:00:00 +0000 | |||
39 | +++ usr/lib/byobu/uclock 2011-02-03 23:10:35 +0000 | |||
40 | @@ -0,0 +1,173 @@ | |||
41 | 1 | #!/bin/bash -e | ||
42 | 2 | #--------------------------------------------------------------------- | ||
43 | 3 | # Script to display a "binary clock" using unicode characters from the | ||
44 | 4 | # braille block. | ||
45 | 5 | # | ||
46 | 6 | # Designed to work with the wonderful byoby(1) but can be run | ||
47 | 7 | # stand-alone. | ||
48 | 8 | #--------------------------------------------------------------------- | ||
49 | 9 | # | ||
50 | 10 | # Copyright (C) 2011 Canonical Ltd. | ||
51 | 11 | # | ||
52 | 12 | # Author: James Hunt <james.hunt@canonical.com> | ||
53 | 13 | # | ||
54 | 14 | # This program is free software: you can redistribute it and/or modify | ||
55 | 15 | # it under the terms of the GNU General Public License as published by | ||
56 | 16 | # the Free Software Foundation, version 3 of the License. | ||
57 | 17 | # | ||
58 | 18 | # This program is distributed in the hope that it will be useful, | ||
59 | 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
60 | 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
61 | 21 | # GNU General Public License for more details. | ||
62 | 22 | # | ||
63 | 23 | # You should have received a copy of the GNU General Public License | ||
64 | 24 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
65 | 25 | # | ||
66 | 26 | #--------------------------------------------------------------------- | ||
67 | 27 | |||
68 | 28 | script_name=${0##*/} | ||
69 | 29 | |||
70 | 30 | # Selected Unicode Braille characters: | ||
71 | 31 | # | ||
72 | 32 | # 0x2800, 0x2880, 0x2820, 0x28a0, 0x2810, 0x2890, 0x2830, 0x28b0, 0x2808, 0x2888, | ||
73 | 33 | # 0x2840, 0x28c0, 0x2860, 0x28e0, 0x2850, 0x28d0, 0x2870, 0x28f0, 0x2848, 0x28c8, | ||
74 | 34 | # 0x2804, 0x2884, 0x2824, 0x28a4, 0x2814, 0x2894, 0x2834, 0x28b4, 0x280c, 0x288c, | ||
75 | 35 | # 0x2844, 0x28c4, 0x2864, 0x28e4, 0x2854, 0x28d4, 0x287b, 0x28f4, 0x284c, 0x28cc, | ||
76 | 36 | # 0x2802, 0x2882, 0x2822, 0x28a2, 0x2812, 0x2892, 0x2832, 0x28b2, 0x280a, 0x288a, | ||
77 | 37 | # 0x2842, 0x28c2, 0x2862, 0x28e2, 0x2852, 0x28d2, 0x2872, 0x28f2, 0x284a, 0x28ca, | ||
78 | 38 | # 0x2806, 0x2886 | ||
79 | 39 | # | ||
80 | 40 | # Index of this array is 0-61 with character returned being | ||
81 | 41 | # "two column" binary representation of a time segment. | ||
82 | 42 | # | ||
83 | 43 | binary=(⠀ ⢀ ⠠ ⢠ ⠐ ⢐ ⠰ ⢰ ⠈ ⢈ \ | ||
84 | 44 | ⡀ ⣀ ⡠ ⣠ ⡐ ⣐ ⡰ ⣰ ⡈ ⣈ \ | ||
85 | 45 | ⠄ ⢄ ⠤ ⢤ ⠔ ⢔ ⠴ ⢴ ⠌ ⢌ \ | ||
86 | 46 | ⡄ ⣄ ⡤ ⣤ ⡔ ⣔ ⡻ ⣴ ⡌ ⣌ \ | ||
87 | 47 | ⠂ ⢂ ⠢ ⢢ ⠒ ⢒ ⠲ ⢲ ⠊ ⢊ \ | ||
88 | 48 | ⡂ ⣂ ⡢ ⣢ ⡒ ⣒ ⡲ ⣲ ⡊ ⣊ ⠆ ⢆) | ||
89 | 49 | |||
90 | 50 | usage() | ||
91 | 51 | { | ||
92 | 52 | cat <<EOT | ||
93 | 53 | Description: A clock that displays the time in binary. | ||
94 | 54 | |||
95 | 55 | Usage: $script_name [options] | ||
96 | 56 | |||
97 | 57 | |||
98 | 58 | Options: | ||
99 | 59 | |||
100 | 60 | -b : Display binary clock (default) | ||
101 | 61 | -h : Show this help. | ||
102 | 62 | -l : Display leading zeros (hex and octal modes only). | ||
103 | 63 | -m : Show time in 24-hour military format | ||
104 | 64 | (default: 12-hour format). | ||
105 | 65 | -n : Suppress newline at end of time. | ||
106 | 66 | -o : Display time in octal (base 8). | ||
107 | 67 | -s <sep> : Specify separator between hours and minutes | ||
108 | 68 | (and seconds if not disabled). | ||
109 | 69 | -u : Display alphabetics in upper-case (hex mode only). | ||
110 | 70 | -x : Disable time in hexadecimal (base 16). | ||
111 | 71 | -z : Disable display of seconds. | ||
112 | 72 | |||
113 | 73 | EOT | ||
114 | 74 | } | ||
115 | 75 | |||
116 | 76 | suppress_seconds=n | ||
117 | 77 | clock_type=binary | ||
118 | 78 | format=std | ||
119 | 79 | ending="\n" | ||
120 | 80 | uppercase=n | ||
121 | 81 | leading_zeros=n | ||
122 | 82 | |||
123 | 83 | while getopts "bhlmnos:uxz" opt | ||
124 | 84 | do | ||
125 | 85 | case "$opt" in | ||
126 | 86 | b) | ||
127 | 87 | clock_type=binary | ||
128 | 88 | ;; | ||
129 | 89 | |||
130 | 90 | h) | ||
131 | 91 | usage | ||
132 | 92 | exit 0 | ||
133 | 93 | ;; | ||
134 | 94 | |||
135 | 95 | l) | ||
136 | 96 | leading_zeros=y | ||
137 | 97 | ;; | ||
138 | 98 | |||
139 | 99 | m) | ||
140 | 100 | format=mil | ||
141 | 101 | ;; | ||
142 | 102 | |||
143 | 103 | n) | ||
144 | 104 | ending= | ||
145 | 105 | ;; | ||
146 | 106 | |||
147 | 107 | o) | ||
148 | 108 | clock_type=oct | ||
149 | 109 | ;; | ||
150 | 110 | |||
151 | 111 | s) | ||
152 | 112 | sep=$OPTARG | ||
153 | 113 | ;; | ||
154 | 114 | |||
155 | 115 | u) | ||
156 | 116 | uppercase=y | ||
157 | 117 | ;; | ||
158 | 118 | |||
159 | 119 | x) | ||
160 | 120 | clock_type=hex | ||
161 | 121 | ;; | ||
162 | 122 | |||
163 | 123 | z) | ||
164 | 124 | suppress_seconds=y | ||
165 | 125 | ;; | ||
166 | 126 | esac | ||
167 | 127 | done | ||
168 | 128 | |||
169 | 129 | if [ -z "$clock_type" ] | ||
170 | 130 | then | ||
171 | 131 | echo "ERROR: must specify clock type" | ||
172 | 132 | exit 1 | ||
173 | 133 | fi | ||
174 | 134 | |||
175 | 135 | shift $[$OPTIND-1] | ||
176 | 136 | |||
177 | 137 | # get current time, handling 12-hour or 24-hour | ||
178 | 138 | if [ $format = std ] | ||
179 | 139 | then | ||
180 | 140 | hrs_format=%l | ||
181 | 141 | else | ||
182 | 142 | hrs_format=%k | ||
183 | 143 | fi | ||
184 | 144 | |||
185 | 145 | time=($(date "+${hrs_format} %M %S")) | ||
186 | 146 | h=$(printf ${time[0]}) | ||
187 | 147 | m=$(printf ${time[1]}) | ||
188 | 148 | s=$(printf ${time[2]}) | ||
189 | 149 | |||
190 | 150 | if [ $clock_type = binary ] | ||
191 | 151 | then | ||
192 | 152 | [ $suppress_seconds = n ] && seconds="${sep}${binary[10#$s]}" | ||
193 | 153 | display_time="${binary[10#$h]}${sep}${binary[10#$m]}${seconds}${ending}" | ||
194 | 154 | else | ||
195 | 155 | if [ $clock_type = hex ] | ||
196 | 156 | then | ||
197 | 157 | conversion=x | ||
198 | 158 | [ $uppercase = y ] && conversion=X | ||
199 | 159 | else | ||
200 | 160 | conversion=o | ||
201 | 161 | fi | ||
202 | 162 | precision= | ||
203 | 163 | [ $leading_zeros = y ] && precision=.2 | ||
204 | 164 | base_format=%2${precision}${conversion} | ||
205 | 165 | |||
206 | 166 | hh=$(printf "$base_format" $h) | ||
207 | 167 | hm=$(printf "$base_format" $m) | ||
208 | 168 | [ "$suppress_seconds" = n ] && hs="${sep}$(printf "$base_format" $s)" | ||
209 | 169 | display_time="${hh}${sep}${hm}${hs}${ending}" | ||
210 | 170 | fi | ||
211 | 171 | |||
212 | 172 | echo -ne "$display_time" | ||
213 | 173 | exit 0 | ||
214 | 0 | 174 | ||
215 | === added file 'usr/lib/byobu/ugraph' | |||
216 | --- usr/lib/byobu/ugraph 1970-01-01 00:00:00 +0000 | |||
217 | +++ usr/lib/byobu/ugraph 2011-02-03 23:10:35 +0000 | |||
218 | @@ -0,0 +1,212 @@ | |||
219 | 1 | #!/bin/bash | ||
220 | 2 | #--------------------------------------------------------------------- | ||
221 | 3 | # Script to display a byobo notification "history graph". | ||
222 | 4 | # | ||
223 | 5 | # Designed to work with the wonderful byoby(1) but can be run | ||
224 | 6 | # stand-alone. | ||
225 | 7 | #--------------------------------------------------------------------- | ||
226 | 8 | # | ||
227 | 9 | # Copyright (C) 2011 Canonical Ltd. | ||
228 | 10 | # | ||
229 | 11 | # Author: James Hunt <james.hunt@canonical.com> | ||
230 | 12 | # | ||
231 | 13 | # This program is free software: you can redistribute it and/or modify | ||
232 | 14 | # it under the terms of the GNU General Public License as published by | ||
233 | 15 | # the Free Software Foundation, version 3 of the License. | ||
234 | 16 | # | ||
235 | 17 | # This program is distributed in the hope that it will be useful, | ||
236 | 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
237 | 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
238 | 20 | # GNU General Public License for more details. | ||
239 | 21 | # | ||
240 | 22 | # You should have received a copy of the GNU General Public License | ||
241 | 23 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
242 | 24 | # | ||
243 | 25 | #--------------------------------------------------------------------- | ||
244 | 26 | |||
245 | 27 | script_name=${0##*/} | ||
246 | 28 | min_default=0 | ||
247 | 29 | max_default=100 | ||
248 | 30 | points_default=5 | ||
249 | 31 | theme_default=vbars_8 | ||
250 | 32 | newline="\n" | ||
251 | 33 | rotate=y | ||
252 | 34 | |||
253 | 35 | error() | ||
254 | 36 | { | ||
255 | 37 | msg="$*" | ||
256 | 38 | echo "ERROR: $msg" >&2 | ||
257 | 39 | } | ||
258 | 40 | |||
259 | 41 | die() | ||
260 | 42 | { | ||
261 | 43 | error "$*" | ||
262 | 44 | exit 1 | ||
263 | 45 | } | ||
264 | 46 | |||
265 | 47 | usage() | ||
266 | 48 | { | ||
267 | 49 | cat <<EOT | ||
268 | 50 | Description: Display a graph of historical indicator values using | ||
269 | 51 | ulevel. | ||
270 | 52 | |||
271 | 53 | Usage: $script_name [options] [command [args...]] | ||
272 | 54 | |||
273 | 55 | Options: | ||
274 | 56 | |||
275 | 57 | -f <file> : File to read data points from. | ||
276 | 58 | (only required if no command specified). | ||
277 | 59 | -h : Show this help. | ||
278 | 60 | -m <num> : Minimum value (default=$min_default). | ||
279 | 61 | -n : Supress output of newline character. | ||
280 | 62 | -p <points> : Specify number of data points in graph | ||
281 | 63 | (default=$points_default). | ||
282 | 64 | -r : Do not rotate file <file> (default is to rotate). | ||
283 | 65 | Option implies file <file> should not be written to | ||
284 | 66 | so a command cannot follow script options in this case. | ||
285 | 67 | -t <theme> : 'ulevel' theme to use (default=$theme_default). | ||
286 | 68 | -x <num> : Maximum value (default=$max_default). | ||
287 | 69 | |||
288 | 70 | |||
289 | 71 | Examples: | ||
290 | 72 | |||
291 | 73 | Using $script_name to run a command, rotate log and display graph. | ||
292 | 74 | |||
293 | 75 | Here we specify a command to display available memory. | ||
294 | 76 | Trailing echo adds a required newline | ||
295 | 77 | Note no filename specified. | ||
296 | 78 | |||
297 | 79 | $script_name "(/usr/lib/byobu/mem_used |sed 's/% //g';echo)" | ||
298 | 80 | |||
299 | 81 | |||
300 | 82 | Using $script_name just to rotate log and display the graph | ||
301 | 83 | |||
302 | 84 | file=/tmp/load.dat | ||
303 | 85 | awk '{ print \$1}' /proc/loadavg >> \$file | ||
304 | 86 | $script_name -f \$file | ||
305 | 87 | |||
306 | 88 | Notes: | ||
307 | 89 | |||
308 | 90 | - If you specify 'command', care must be taken with shell quoting to | ||
309 | 91 | avoid expansion prior to this script running the command. | ||
310 | 92 | - If '-r' is not specified, the file <file> will be rotated such that | ||
311 | 93 | at most <points> lines are retained on each invocation of this | ||
312 | 94 | script. | ||
313 | 95 | |||
314 | 96 | EOT | ||
315 | 97 | } | ||
316 | 98 | |||
317 | 99 | get_data() | ||
318 | 100 | { | ||
319 | 101 | needed_lines=$points | ||
320 | 102 | |||
321 | 103 | if [ ! -f $file ] | ||
322 | 104 | then | ||
323 | 105 | return | ||
324 | 106 | fi | ||
325 | 107 | |||
326 | 108 | lines=$(wc -l $file|awk '{print $1}') | ||
327 | 109 | |||
328 | 110 | if [ $lines -lt $needed_lines ] | ||
329 | 111 | then | ||
330 | 112 | # insufficient data | ||
331 | 113 | return | ||
332 | 114 | fi | ||
333 | 115 | |||
334 | 116 | bytes=$(<${file}) | ||
335 | 117 | bytes=$(echo "$bytes"|tail -n ${needed_lines}) | ||
336 | 118 | [ $lines -eq $needed_lines -o $rotate = n ] && echo "$bytes" && return | ||
337 | 119 | |||
338 | 120 | # rotate | ||
339 | 121 | tmp=`tempfile` | ||
340 | 122 | echo "$bytes" > $tmp | ||
341 | 123 | mv $tmp $file | ||
342 | 124 | |||
343 | 125 | echo "$bytes" | ||
344 | 126 | } | ||
345 | 127 | |||
346 | 128 | while getopts "f:hm:np:rt:x:" opt | ||
347 | 129 | do | ||
348 | 130 | case "$opt" in | ||
349 | 131 | f) | ||
350 | 132 | file="$OPTARG" | ||
351 | 133 | ;; | ||
352 | 134 | |||
353 | 135 | h) | ||
354 | 136 | usage | ||
355 | 137 | exit 0 | ||
356 | 138 | ;; | ||
357 | 139 | |||
358 | 140 | m) | ||
359 | 141 | min=$OPTARG | ||
360 | 142 | ;; | ||
361 | 143 | |||
362 | 144 | n) | ||
363 | 145 | newline= | ||
364 | 146 | ;; | ||
365 | 147 | |||
366 | 148 | p) | ||
367 | 149 | points=$OPTARG | ||
368 | 150 | ;; | ||
369 | 151 | |||
370 | 152 | r) | ||
371 | 153 | rotate=n | ||
372 | 154 | ;; | ||
373 | 155 | |||
374 | 156 | t) | ||
375 | 157 | theme="$OPTARG" | ||
376 | 158 | ;; | ||
377 | 159 | |||
378 | 160 | x) | ||
379 | 161 | max=$OPTARG | ||
380 | 162 | ;; | ||
381 | 163 | esac | ||
382 | 164 | done | ||
383 | 165 | |||
384 | 166 | shift $[$OPTIND-1] | ||
385 | 167 | |||
386 | 168 | cmd="$@" | ||
387 | 169 | |||
388 | 170 | [ -z "$theme" ] && theme=$theme_default | ||
389 | 171 | |||
390 | 172 | if [ -z "$cmd" ] | ||
391 | 173 | then | ||
392 | 174 | if [ -z "$file" ] | ||
393 | 175 | then | ||
394 | 176 | error "must specify file" | ||
395 | 177 | usage | ||
396 | 178 | exit 1 | ||
397 | 179 | fi | ||
398 | 180 | fi | ||
399 | 181 | |||
400 | 182 | if [ -z "$file" ] | ||
401 | 183 | then | ||
402 | 184 | # we could go cryptic+safe by calling tempfile(1), but that then | ||
403 | 185 | # makes it very difficult to find in case of need. | ||
404 | 186 | file=/tmp/${USER}-${script_name}-$$.dat | ||
405 | 187 | fi | ||
406 | 188 | |||
407 | 189 | [ -z "$min" ] && min=$min_default | ||
408 | 190 | [ -z "$max" ] && max=$max_default | ||
409 | 191 | [ -z "$points" ] && points=$points_default | ||
410 | 192 | |||
411 | 193 | if [ ! -z "$cmd" ] | ||
412 | 194 | then | ||
413 | 195 | if [ $rotate = n ] | ||
414 | 196 | then | ||
415 | 197 | error "cannot write to file if rotate disabled" | ||
416 | 198 | usage | ||
417 | 199 | exit 1 | ||
418 | 200 | fi | ||
419 | 201 | |||
420 | 202 | eval "$cmd >>$file" | ||
421 | 203 | fi | ||
422 | 204 | |||
423 | 205 | data=$(get_data) | ||
424 | 206 | |||
425 | 207 | [ -z "$data" ] && printf "%*.s${newline}" $points && exit 0 | ||
426 | 208 | |||
427 | 209 | for datum in $data | ||
428 | 210 | do | ||
429 | 211 | ulevel.sh -n -m $min -x $max -c $datum -t $theme | ||
430 | 212 | done | ||
431 | 0 | 213 | ||
432 | === added file 'usr/lib/byobu/ulevel' | |||
433 | --- usr/lib/byobu/ulevel 1970-01-01 00:00:00 +0000 | |||
434 | +++ usr/lib/byobu/ulevel 2011-02-03 23:10:35 +0000 | |||
435 | @@ -0,0 +1,481 @@ | |||
436 | 1 | #!/bin/bash | ||
437 | 2 | #--------------------------------------------------------------------- | ||
438 | 3 | # Script to display unicode characters representing the level of | ||
439 | 4 | # some indicator. | ||
440 | 5 | # | ||
441 | 6 | # Designed to work with the wonderful byoby(1) but can be run | ||
442 | 7 | # stand-alone. | ||
443 | 8 | #--------------------------------------------------------------------- | ||
444 | 9 | # | ||
445 | 10 | # Copyright (C) 2011 Canonical Ltd. | ||
446 | 11 | # | ||
447 | 12 | # Author: James Hunt <james.hunt@canonical.com> | ||
448 | 13 | # | ||
449 | 14 | # This program is free software: you can redistribute it and/or modify | ||
450 | 15 | # it under the terms of the GNU General Public License as published by | ||
451 | 16 | # the Free Software Foundation, version 3 of the License. | ||
452 | 17 | # | ||
453 | 18 | # This program is distributed in the hope that it will be useful, | ||
454 | 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
455 | 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
456 | 21 | # GNU General Public License for more details. | ||
457 | 22 | # | ||
458 | 23 | # You should have received a copy of the GNU General Public License | ||
459 | 24 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
460 | 25 | # | ||
461 | 26 | #--------------------------------------------------------------------- | ||
462 | 27 | |||
463 | 28 | #------------------------------ | ||
464 | 29 | # Themes with 2 values. | ||
465 | 30 | # | ||
466 | 31 | # Two-value themes are handled differently to other n-value types of | ||
467 | 32 | # theme: the first array entry in each theme is generally some unfilled | ||
468 | 33 | # glyph, denoting an "off" value and the second value is the filled | ||
469 | 34 | # version of the unfilled glyph and denotes an "on" value. Note that | ||
470 | 35 | # you can always change the ordering of these values using the 'invert' | ||
471 | 36 | # command-line option. | ||
472 | 37 | |||
473 | 38 | circles_2=(○ ●) | ||
474 | 39 | diamonds_2=(◇ ◆) | ||
475 | 40 | flags_2=(⚐ ⚑) | ||
476 | 41 | hearts_2=(♡ ♥) | ||
477 | 42 | squares_2=(◻ ◼) | ||
478 | 43 | squares_small_2=(◽ ◾) | ||
479 | 44 | stars_2=(☆ ★) | ||
480 | 45 | |||
481 | 46 | #------------------------------ | ||
482 | 47 | # Themes with 4 values. | ||
483 | 48 | |||
484 | 49 | vdots_thick_4=(⣀ ⣤ ⣶ ⣿) | ||
485 | 50 | vdots_thin_4=(⢀ ⢠ ⢰ ⢸) | ||
486 | 51 | fractions_4=(¼ ½ ¾ ¹) | ||
487 | 52 | quadrants_4=(◔ ◑ ◕ ●) | ||
488 | 53 | shades_4=(░ ▒ ▓ █) | ||
489 | 54 | |||
490 | 55 | #------------------------------ | ||
491 | 56 | # Themes with 5 values. | ||
492 | 57 | |||
493 | 58 | circles_5=(◦ ○ ◎ ◉ ●) | ||
494 | 59 | |||
495 | 60 | #------------------------------ | ||
496 | 61 | # Themes with 6 values. | ||
497 | 62 | |||
498 | 63 | dice_6=(⚀ ⚁ ⚂ ⚃ ⚄ ⚅) | ||
499 | 64 | |||
500 | 65 | #------------------------------ | ||
501 | 66 | # Themes with 8 values. | ||
502 | 67 | |||
503 | 68 | hbars_8=(▏ ▎ ▍ ▌ ▋ ▊ ▉ █) | ||
504 | 69 | vbars_8=(▁ ▂ ▃ ▄ ▅ ▆ ▇ █) | ||
505 | 70 | |||
506 | 71 | #------------------------------ | ||
507 | 72 | # Themes with 10 values. | ||
508 | 73 | |||
509 | 74 | circle_number_10=(➀ ➁ ➂ ➃ ➄ ➅ ➆ ➇ ➈ ➉) | ||
510 | 75 | solid_numbers_a_10=(➊ ➋ ➌ ➍ ➎ ➏ ➐ ➑ ➒ ➓) | ||
511 | 76 | solid_numbers_b_10=(❶ ❷ ❸ ❹ ❺ ❻ ❼ ❽ ❾ ❿) | ||
512 | 77 | |||
513 | 78 | #------------------------------ | ||
514 | 79 | # XXX: remember to update if you add new themes above! | ||
515 | 80 | |||
516 | 81 | theme_list=\ | ||
517 | 82 | ( | ||
518 | 83 | 'circles_2 diamonds_2 flags_2 hearts_2 squares_2 squares_small_2 stars_2' | ||
519 | 84 | 'vdots_thick_4 vdots_thin_4 fractions_4 quadrants_4 shades_4' | ||
520 | 85 | 'circles_5' | ||
521 | 86 | 'dice_6' | ||
522 | 87 | 'hbars_8 vbars_8' | ||
523 | 88 | 'circle_number_10 solid_numbers_a_10 solid_numbers_b_10' | ||
524 | 89 | ) | ||
525 | 90 | |||
526 | 91 | #------------------------------ | ||
527 | 92 | |||
528 | 93 | debug_enabled=n | ||
529 | 94 | newline= | ||
530 | 95 | list=n | ||
531 | 96 | quiet=n | ||
532 | 97 | invert=n | ||
533 | 98 | reverse=n | ||
534 | 99 | script_name=${0##*/} | ||
535 | 100 | min_default=0 | ||
536 | 101 | max_default=100 | ||
537 | 102 | width_default=5 | ||
538 | 103 | zero_as_space=n | ||
539 | 104 | theme_default=vbars_8 | ||
540 | 105 | |||
541 | 106 | debug() | ||
542 | 107 | { | ||
543 | 108 | msg="$*" | ||
544 | 109 | [ $debug_enabled = y ] && echo "DEBUG: $msg" | ||
545 | 110 | } | ||
546 | 111 | |||
547 | 112 | error() | ||
548 | 113 | { | ||
549 | 114 | msg="$*" | ||
550 | 115 | echo "ERROR: $msg" >&2 | ||
551 | 116 | } | ||
552 | 117 | |||
553 | 118 | die() | ||
554 | 119 | { | ||
555 | 120 | error "$*" | ||
556 | 121 | exit 1 | ||
557 | 122 | } | ||
558 | 123 | |||
559 | 124 | bc_test() | ||
560 | 125 | { | ||
561 | 126 | expr="$*" | ||
562 | 127 | echo $(echo "if ( $expr ) { print \"1\" }"|bc -l) | ||
563 | 128 | } | ||
564 | 129 | |||
565 | 130 | assert() | ||
566 | 131 | { | ||
567 | 132 | expr="$1" | ||
568 | 133 | str="$2" | ||
569 | 134 | |||
570 | 135 | debug "assert: expr='$expr'" | ||
571 | 136 | ret=$(bc_test "$expr") | ||
572 | 137 | |||
573 | 138 | [ ! -z "$ret" ] && return | ||
574 | 139 | |||
575 | 140 | die "$str" | ||
576 | 141 | } | ||
577 | 142 | |||
578 | 143 | usage() | ||
579 | 144 | { | ||
580 | 145 | cat <<EOT | ||
581 | 146 | Description: Display unicode characters representing the relative | ||
582 | 147 | level of some indicator value within a range. | ||
583 | 148 | |||
584 | 149 | Usage: $script_name [options] -c <current_num> | ||
585 | 150 | $script_name [options] <current_num> | ||
586 | 151 | $script_name <current_num> | ||
587 | 152 | |||
588 | 153 | Options: | ||
589 | 154 | |||
590 | 155 | -b : Display current value as space if zero, rather than lowest | ||
591 | 156 | 'value' of theme. | ||
592 | 157 | -c <num> : Current value of your indicator. | ||
593 | 158 | -d : Enable debug output. | ||
594 | 159 | -h : Show this help. | ||
595 | 160 | -i : Invert colour scheme (rating themes only). | ||
596 | 161 | -l : List available themes. If '-t' also specified, | ||
597 | 162 | show all values for specified theme. | ||
598 | 163 | -m <num> : Minimum value (default=$min_default). | ||
599 | 164 | -n : Supress output of newline character. | ||
600 | 165 | -q : Suppress messages (requires '-t'). | ||
601 | 166 | -r : Reverse 'direction' of display (rating theme only). | ||
602 | 167 | -t <theme> : Name of theme (default=$theme_default). | ||
603 | 168 | -u <chars> : Specify a user theme (2 or more values). | ||
604 | 169 | -w <int> : Width of rating theme (default=$width_default). | ||
605 | 170 | -x <num> : Maximum value (default=$max_default). | ||
606 | 171 | |||
607 | 172 | |||
608 | 173 | Examples: | ||
609 | 174 | |||
610 | 175 | # Display character representing 27% using default theme. | ||
611 | 176 | $script_name 27 | ||
612 | 177 | |||
613 | 178 | # As above. | ||
614 | 179 | $script_name -c 27 | ||
615 | 180 | |||
616 | 181 | # Example showing floating-point and negative values. | ||
617 | 182 | $script_name -c 1.100001 -m -5.00234 -x 2.71828 -t dice_6 | ||
618 | 183 | |||
619 | 184 | # Display value using a "rating theme" (displayed left-to-right). | ||
620 | 185 | $script_name -c 83 -t stars_2 | ||
621 | 186 | |||
622 | 187 | # Display right-to-left inverted "rating theme". | ||
623 | 188 | $script_name -c 60 -t diamonds_2 -ri | ||
624 | 189 | |||
625 | 190 | # Display all glyphs in 'solid_numbers_a_10' theme. | ||
626 | 191 | $script_name -l -t solid_numbers_a_10 | ||
627 | 192 | |||
628 | 193 | # Display a user-specified rating theme 10 glyphs wide. | ||
629 | 194 | $script_name -c 666.321 -m -273.15 -x 1370 -u "· ☢" -w 10 | ||
630 | 195 | |||
631 | 196 | # A multi-element user theme (this prints 'e'). | ||
632 | 197 | $script_name -c 50 -u "a b c d e f g h i j" | ||
633 | 198 | |||
634 | 199 | |||
635 | 200 | Notes: | ||
636 | 201 | |||
637 | 202 | - Arguments of type "<int>" denote an integer value, whereas arguments | ||
638 | 203 | of type "<num>" denotes either an integer or a floating-point | ||
639 | 204 | number. | ||
640 | 205 | - The final '_<number>' in a theme name denotes the number of glyphs | ||
641 | 206 | in it. | ||
642 | 207 | - "Rating themes" are those with only 2 values. | ||
643 | 208 | - The <chars> argument to '-u' must contain space-delimited | ||
644 | 209 | characters. | ||
645 | 210 | |||
646 | 211 | EOT | ||
647 | 212 | } | ||
648 | 213 | |||
649 | 214 | # this is horribly inefficient - we should probably do some clever | ||
650 | 215 | # tricks using printf formats to avoid the silly while loop. | ||
651 | 216 | # Additionally, it is rather similar to show_theme_entry() but was split | ||
652 | 217 | # out from that in a vain attempt to make the overall logic clearer :) | ||
653 | 218 | show_rating_theme() | ||
654 | 219 | { | ||
655 | 220 | theme="$1" | ||
656 | 221 | min="$2" | ||
657 | 222 | max="$3" | ||
658 | 223 | current="$4" | ||
659 | 224 | quotient="$5" | ||
660 | 225 | |||
661 | 226 | if [ $invert = n ] | ||
662 | 227 | then | ||
663 | 228 | on=1 | ||
664 | 229 | off=0 | ||
665 | 230 | else | ||
666 | 231 | on=0 | ||
667 | 232 | off=1 | ||
668 | 233 | fi | ||
669 | 234 | |||
670 | 235 | percent=$(echo "$quotient * 100"|bc -l) | ||
671 | 236 | debug "width=$width" | ||
672 | 237 | debug "percent=$percent" | ||
673 | 238 | |||
674 | 239 | percent_per_glyph=$(echo "scale=4;100/${width}"|bc -l) | ||
675 | 240 | assert "$percent_per_glyph > 1.0" "width ($width) too great" | ||
676 | 241 | debug "percent_per_glyph=$percent_per_glyph" | ||
677 | 242 | |||
678 | 243 | debug "glyph_count=$glyph_count" | ||
679 | 244 | |||
680 | 245 | g=$percent_per_glyph | ||
681 | 246 | i=0 | ||
682 | 247 | value="" | ||
683 | 248 | while [ $i -lt $width ] | ||
684 | 249 | do | ||
685 | 250 | if [ ! -z "$(bc_test "$g <= $percent")" ] | ||
686 | 251 | then | ||
687 | 252 | eval content="\${$theme[${on}]}" | ||
688 | 253 | else | ||
689 | 254 | eval content="\${$theme[${off}]}" | ||
690 | 255 | fi | ||
691 | 256 | if [ $reverse = n ] | ||
692 | 257 | then | ||
693 | 258 | value="${value}${content}" | ||
694 | 259 | else | ||
695 | 260 | value="${content}${value}" | ||
696 | 261 | fi | ||
697 | 262 | g=$(echo "$g + $percent_per_glyph"|bc -l) | ||
698 | 263 | i=$((i + 1)) | ||
699 | 264 | done | ||
700 | 265 | echo $newline "$value" | ||
701 | 266 | } | ||
702 | 267 | |||
703 | 268 | show_theme_entry() | ||
704 | 269 | { | ||
705 | 270 | theme="$1" | ||
706 | 271 | min="$2" | ||
707 | 272 | max="$3" | ||
708 | 273 | current="$4" | ||
709 | 274 | |||
710 | 275 | debug "theme=$theme" | ||
711 | 276 | debug "min=$min" | ||
712 | 277 | debug "max=$max" | ||
713 | 278 | debug "current=$current" | ||
714 | 279 | |||
715 | 280 | range=$(echo "($max - $min)"|bc -l) | ||
716 | 281 | |||
717 | 282 | quotient=$(echo "scale=4;((${current} - ${min})/${range})"|bc -l) | ||
718 | 283 | |||
719 | 284 | glyph_count=$(echo $theme|awk -F\_ '{print $NF}') | ||
720 | 285 | |||
721 | 286 | debug "range=$range" | ||
722 | 287 | debug "quotient=$quotient" | ||
723 | 288 | debug "glyph_count=$glyph_count" | ||
724 | 289 | |||
725 | 290 | if [ $glyph_count -eq 2 ] | ||
726 | 291 | then | ||
727 | 292 | show_rating_theme "$theme" "$min" "$max" "$current" "$quotient" | ||
728 | 293 | return | ||
729 | 294 | fi | ||
730 | 295 | |||
731 | 296 | percent_per_glyph=$(echo "100/$glyph_count"|bc -l) | ||
732 | 297 | debug "percent_per_glyph=$percent_per_glyph" | ||
733 | 298 | |||
734 | 299 | assert "$percent_per_glyph > 1.0" "width ($width) too great" | ||
735 | 300 | |||
736 | 301 | # with this scheme, assuming current value is 0-100 and theme has 10 | ||
737 | 302 | # elements: | ||
738 | 303 | # | ||
739 | 304 | # current glyph from theme | ||
740 | 305 | # | ||
741 | 306 | # 0-19 1st | ||
742 | 307 | # 20-29 2nd | ||
743 | 308 | # 30-39 3rd | ||
744 | 309 | # : | ||
745 | 310 | # 90-99 9th | ||
746 | 311 | # 100 10th | ||
747 | 312 | i=$(echo|awk \ | ||
748 | 313 | -v quotient=$quotient \ | ||
749 | 314 | -v glyph_count=$glyph_count \ | ||
750 | 315 | '{ | ||
751 | 316 | x= int( (quotient * glyph_count) ) - 1; | ||
752 | 317 | x = (x > (glyph_count-1) ? (glyph_count-1) : x); | ||
753 | 318 | if ( x < 0 ) x = 0; | ||
754 | 319 | printf("%d", x); | ||
755 | 320 | }') | ||
756 | 321 | |||
757 | 322 | debug "index=$i" | ||
758 | 323 | eval content="\${$theme[$i]}" | ||
759 | 324 | |||
760 | 325 | [ ! -z "$(bc_test "$current == 0")" -a $zero_as_space = y ] && content=' ' | ||
761 | 326 | echo $newline "$content" | ||
762 | 327 | |||
763 | 328 | return | ||
764 | 329 | } | ||
765 | 330 | |||
766 | 331 | list_theme() | ||
767 | 332 | { | ||
768 | 333 | theme="$1" | ||
769 | 334 | eval content="\${$theme[@]}" | ||
770 | 335 | echo | ||
771 | 336 | for c in $content | ||
772 | 337 | do | ||
773 | 338 | echo -n "$c " | ||
774 | 339 | done | ||
775 | 340 | echo -e "\n" | ||
776 | 341 | } | ||
777 | 342 | |||
778 | 343 | list_themes() | ||
779 | 344 | { | ||
780 | 345 | for entry in ${theme_list[@]} | ||
781 | 346 | do | ||
782 | 347 | for arg in "$entry" | ||
783 | 348 | do | ||
784 | 349 | echo "$arg" | ||
785 | 350 | done | ||
786 | 351 | done | ||
787 | 352 | } | ||
788 | 353 | |||
789 | 354 | theme_valid() | ||
790 | 355 | { | ||
791 | 356 | theme="$1" | ||
792 | 357 | [ -z "`list_themes|grep "^${theme}$"`" ] && return 1 | ||
793 | 358 | return 0 | ||
794 | 359 | } | ||
795 | 360 | |||
796 | 361 | # XXX: the seemingly pointless 'tr' calls translate unicode dashes (look | ||
797 | 362 | # closely!) into ASCII dashes. This is required since 'bc' borks on | ||
798 | 363 | # unicode and it is easy to mistakenly pass unicode dashes if you paste | ||
799 | 364 | # characters from another application, such as a web-browser. | ||
800 | 365 | while getopts "bc:dhilm:nqrt:u:w:x:" opt | ||
801 | 366 | do | ||
802 | 367 | case "$opt" in | ||
803 | 368 | b) | ||
804 | 369 | zero_as_space=y | ||
805 | 370 | ;; | ||
806 | 371 | |||
807 | 372 | c) | ||
808 | 373 | current=$(echo $OPTARG|tr '−' '-') | ||
809 | 374 | ;; | ||
810 | 375 | |||
811 | 376 | d) | ||
812 | 377 | debug_enabled=y | ||
813 | 378 | ;; | ||
814 | 379 | |||
815 | 380 | h) | ||
816 | 381 | usage | ||
817 | 382 | exit 0 | ||
818 | 383 | ;; | ||
819 | 384 | |||
820 | 385 | i) | ||
821 | 386 | invert=y | ||
822 | 387 | ;; | ||
823 | 388 | |||
824 | 389 | l) | ||
825 | 390 | list=y | ||
826 | 391 | ;; | ||
827 | 392 | |||
828 | 393 | m) | ||
829 | 394 | min=$(echo $OPTARG|tr '−' '-') | ||
830 | 395 | ;; | ||
831 | 396 | |||
832 | 397 | n) | ||
833 | 398 | newline=-n | ||
834 | 399 | ;; | ||
835 | 400 | |||
836 | 401 | q) | ||
837 | 402 | quiet=y | ||
838 | 403 | ;; | ||
839 | 404 | |||
840 | 405 | r) | ||
841 | 406 | reverse=y | ||
842 | 407 | ;; | ||
843 | 408 | |||
844 | 409 | t) | ||
845 | 410 | theme=$OPTARG | ||
846 | 411 | ;; | ||
847 | 412 | |||
848 | 413 | u) | ||
849 | 414 | user_theme="$OPTARG" | ||
850 | 415 | ;; | ||
851 | 416 | |||
852 | 417 | w) | ||
853 | 418 | width=$OPTARG | ||
854 | 419 | ;; | ||
855 | 420 | |||
856 | 421 | x) | ||
857 | 422 | max=$(echo $OPTARG|tr '−' '-') | ||
858 | 423 | ;; | ||
859 | 424 | esac | ||
860 | 425 | done | ||
861 | 426 | |||
862 | 427 | shift $[$OPTIND-1] | ||
863 | 428 | |||
864 | 429 | if [ ! -z "$user_theme" ] | ||
865 | 430 | then | ||
866 | 431 | elements=$(echo "$user_theme"|awk '{print NF}') | ||
867 | 432 | |||
868 | 433 | assert "$elements >= 2" "user themes need >= 2 values" | ||
869 | 434 | |||
870 | 435 | # create new theme | ||
871 | 436 | name="_user_${elements}" | ||
872 | 437 | eval "$name=($user_theme)" | ||
873 | 438 | |||
874 | 439 | # add it to list | ||
875 | 440 | theme_list=("${theme_list[@]}" $name) | ||
876 | 441 | |||
877 | 442 | [ -z "$theme" ] && theme=$name | ||
878 | 443 | fi | ||
879 | 444 | |||
880 | 445 | if [ "$list" = y ] | ||
881 | 446 | then | ||
882 | 447 | if [ -z "$theme" ] | ||
883 | 448 | then | ||
884 | 449 | list_themes && exit 0 | ||
885 | 450 | else | ||
886 | 451 | theme_valid "$theme" || die "invalid theme: $theme" | ||
887 | 452 | [ "$quiet" = n ] && echo "Listing theme '$theme'" | ||
888 | 453 | list_theme $theme && exit 0 | ||
889 | 454 | fi | ||
890 | 455 | fi | ||
891 | 456 | [ -z "$min" ] && min=$min_default | ||
892 | 457 | [ -z "$max" ] && max=$max_default | ||
893 | 458 | [ -z "$width" ] && width=$width_default | ||
894 | 459 | |||
895 | 460 | assert "$min <= $max" "minimum ($min) > maximum ($max)" | ||
896 | 461 | assert "$min != $max" "minimum ($min) == maximum" | ||
897 | 462 | |||
898 | 463 | [ -z "$current" -a ! -z "$1" ] && current="$1" | ||
899 | 464 | |||
900 | 465 | if [ -z "$current" ] | ||
901 | 466 | then | ||
902 | 467 | error "must specify current value" | ||
903 | 468 | usage | ||
904 | 469 | exit 1 | ||
905 | 470 | fi | ||
906 | 471 | |||
907 | 472 | assert "$current >= $min" "current ($current) < minimum ($min)" | ||
908 | 473 | assert "$current <= $max" "current ($current) > maximum ($max)" | ||
909 | 474 | |||
910 | 475 | [ -z "$theme" ] && theme=$theme_default | ||
911 | 476 | |||
912 | 477 | theme_valid "$theme" || die "invalid theme: $theme" | ||
913 | 478 | |||
914 | 479 | show_theme_entry $theme $min $max $current | ||
915 | 480 | |||
916 | 481 | exit 0 | ||
917 | 0 | 482 | ||
918 | === added file 'usr/lib/byobu/wastebasket' | |||
919 | --- usr/lib/byobu/wastebasket 1970-01-01 00:00:00 +0000 | |||
920 | +++ usr/lib/byobu/wastebasket 2011-02-03 23:10:35 +0000 | |||
921 | @@ -0,0 +1,39 @@ | |||
922 | 1 | #!/bin/sh -e | ||
923 | 2 | # | ||
924 | 3 | # wastebasket: show icon (and optionally count) if entries in wastebasket. | ||
925 | 4 | # Copyright (C) 2011 Canonical Ltd. | ||
926 | 5 | # | ||
927 | 6 | # Authors: James Hunt <james.hunt@canonical.com> | ||
928 | 7 | |||
929 | 8 | # This program is free software: you can redistribute it and/or modify | ||
930 | 9 | # it under the terms of the GNU General Public License as published by | ||
931 | 10 | # the Free Software Foundation, version 3 of the License. | ||
932 | 11 | # | ||
933 | 12 | # This program is distributed in the hope that it will be useful, | ||
934 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
935 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
936 | 15 | # GNU General Public License for more details. | ||
937 | 16 | # | ||
938 | 17 | # You should have received a copy of the GNU General Public License | ||
939 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
940 | 19 | # | ||
941 | 20 | |||
942 | 21 | PKG="byobu" | ||
943 | 22 | color 2>/dev/null || color() { true; } | ||
944 | 23 | |||
945 | 24 | [ "$UTF8" = "1" ] && ICON="♸" || ICON="W" | ||
946 | 25 | |||
947 | 26 | dir=$HOME/.local/share/Trash/files | ||
948 | 27 | |||
949 | 28 | [ ! -d $dir ] && exit 0 | ||
950 | 29 | count=$(ls $dir|wc -l) | ||
951 | 30 | [ "$count" -eq 0 ] && exit 0 | ||
952 | 31 | |||
953 | 32 | if [ "$1" = "--detail" ] | ||
954 | 33 | then | ||
955 | 34 | echo -n "${ICON}[$count]" | ||
956 | 35 | else | ||
957 | 36 | echo -n $ICON | ||
958 | 37 | fi | ||
959 | 38 | |||
960 | 39 | exit 0 | ||
961 | 0 | 40 | ||
962 | === modified file 'usr/lib/byobu/wifi_quality' | |||
963 | --- usr/lib/byobu/wifi_quality 2011-01-31 23:19:40 +0000 | |||
964 | +++ usr/lib/byobu/wifi_quality 2011-02-03 23:10:35 +0000 | |||
965 | @@ -19,6 +19,7 @@ | |||
966 | 19 | 19 | ||
967 | 20 | PKG="byobu" | 20 | PKG="byobu" |
968 | 21 | color 2>/dev/null || color() { true; } | 21 | color 2>/dev/null || color() { true; } |
969 | 22 | [ "$UTF8" = "1" ] && ICON="⚚" || ICON= | ||
970 | 22 | 23 | ||
971 | 23 | if [ "$1" = "--detail" ]; then | 24 | if [ "$1" = "--detail" ]; then |
972 | 24 | /sbin/iwconfig 2>/dev/null | 25 | /sbin/iwconfig 2>/dev/null |
973 | @@ -35,4 +36,4 @@ | |||
974 | 35 | quality=`echo "$quality" | awk -F/ '{printf "%.0f", 100*$1/$2}'` | 36 | quality=`echo "$quality" | awk -F/ '{printf "%.0f", 100*$1/$2}'` |
975 | 36 | fi | 37 | fi |
976 | 37 | [ "$quality" = "0" ] && exit 0 | 38 | [ "$quality" = "0" ] && exit 0 |
978 | 38 | printf "$(color b C k)%s$(color -)$(color C k)%s,$(color -)$(color b C k)%s$(color -)$(color C k)%%$(color -) " "$bitrate" "Mbps" "$quality" | 39 | printf "${ICON}$(color b C k)%s$(color -)$(color C k)%s,$(color -)$(color b C k)%s$(color -)$(color C k)%%$(color -) " "$bitrate" "Mbps" "$quality" |