chiark / gitweb /
example: Fix usage
[chiark-tcl-applet.git] / example
diff --git a/example b/example
index 4a6a16a2e886bbacfb88d9d6096f6383a97e1d27..d783f3fd745296e28ff08c3a212c878ee63da8fd 100755 (executable)
--- a/example
+++ b/example
@@ -1,28 +1,43 @@
-#!/usr/bin/wish8.4 -f
+#!/usr/bin/wish -f
 # -*- Tcl -*-
 
+# Copyright 2016,2020 Ian Jackson
+# SPDX-License-Identifier: GPL-3.0-or-later
+# There is NO WARRANTY.
+
+# usage:
+#   .../example program arguments...
+# will run
+#   program arguments... WINDOWID
+# and program sbould put up an X11 window as a child of WINDOWID
+#
+# eg, for a silly example:
+#   .../example xterm -id
+
 source applet.tcl
+source subproc.tcl
+source utils.tcl
 
-#----- specifics -----
+set debug::debug puts
 
-.m1 add command -command { msel; puts hi } -label hi
-.m3 add command -command { msel; puts boo } -label boo
+foreach b {1 3} {
+    applet::setup-button-menu $b
+}
 
-image create bitmap ims -file gs_s.xbm   
+.m1 add command -command { applet::msel; puts hi } -label hi
+.m3 add command -command { applet::msel; puts boo } -label boo
+
+#image create bitmap ims -file gs_s.xbm   
 #image create bitmap ims -file /usr/share/ghostscript/8.71/lib/gs_s.xbm   
 #setimage ims
 #setimage ims
 
-setuptooltip
-settooltip "line\nanother"
-
-proc innerwindow {id} {
-    puts IICONFIG
-    puts "IC $id"
+applet::setup-tooltip { puts VIS } { puts INVIS }
+applet::tooltip-set "line\nanother"
 
-    .i.i.b configure -background darkblue -bd 1
-exec /home/ian/things/Chiark-utils/chiark-utils.git/cprogs/xacpi-simple \
-       -into $id &
+proc cmdline {id orientation} {
+    global argv
+    return [concat $argv $id]
 }
 
-setupinnerwindow 40
+applet::setup-subproc cmdline