#!/usr/bin/wish -f
# -*- Tcl -*-
+# Copyright 2016,2020 Ian Jackson
+# SPDX-License-Identifier: GPL-3.0-or-later
+# There is NO WARRANTY.
+
# usage:
# xbatmon-simple-tray
# [WISH-OPTIONS... [-- TRAY-EMBED-OPTIONS... [-- XBATMON-SIMPLE-OPTIONS...]]]
-source subproc.tcl
-source utils.tcl
-source args.tcl
+set lib .
+
+source $lib/subproc.tcl
+source $lib/utils.tcl
+source $lib/args.tcl
proc cmdline {id orientation} {
global argv
}
}
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 {
#----- modes -----
proc mode/normal {} {
- uplevel #0 source applet.tcl
+ uplevel #0 { source $lib/applet.tcl }
applet::setup-subproc cmdline
applet::setup-tooltip tt-show tt-invisible
}