chiark
/
gitweb
/
~ian
/
chiark-tcl-applet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7033cfe
)
guess TYPE from PRESENT and ONLINE
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Tue, 6 Nov 2012 12:26:38 +0000
(12:26 +0000)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Tue, 6 Nov 2012 12:26:38 +0000
(12:26 +0000)
xbatmon-simple-tray
patch
|
blob
|
history
diff --git
a/xbatmon-simple-tray
b/xbatmon-simple-tray
index 9f2cdbadcc663950f825606980a5b164d11cb81b..135fe6a22b9943b4688661beaab938887efa4c3d 100755
(executable)
--- a/
xbatmon-simple-tray
+++ b/
xbatmon-simple-tray
@@
-141,7
+141,18
@@
proc tt-info {chan} {
}
}
debug::debug "GOT [array names a]"
+ if {![info exists a(TYPE)]} {
+ set op {}
+ foreach k {ONLINE PRESENT} { append op [info exists a($k)] }
+ switch -exact $op {
+ 10 { set a(TYPE) Mains }
+ 01 { set a(TYPE) Battery }
+ default { error "no type and bad op $op" }
+ }
+ debug::debug " guessed type $a(TYPE) from ONLINE PRESENT $op"
+ }
set o "$a(TYPE)"
+
set nbatts 0
switch -exact -- $a(TYPE) {
Mains {