chiark / gitweb /
applet: Introduce applet::become
[chiark-tcl-applet.git] / applet.tcl
index 871cf97f380764a13088b7495d3f4cc2bbcc98d0..5e300aba53bd032a5f16e402b2441ac9a6d83917 100644 (file)
@@ -68,16 +68,17 @@ package require tktray
 #
 #  This also uses the same variables as setup-subwindow.
 
-wm withdraw .
-
-tktray::icon .i -class example
-.i configure -docked 1
+namespace eval applet {
 
-fconfigure stdout -buffering none
-fconfigure stderr -buffering none
+proc become {} {
+    wm withdraw .
 
+    tktray::icon .i -class example
+    .i configure -docked 1
 
-namespace eval applet {
+    fconfigure stdout -buffering none
+    fconfigure stderr -buffering none
+}
 
 # used by both menus and tooltips
 variable posted 0