chiark / gitweb /
after hacking got it to work, needs tidying up.
[chiark-tcl-applet.git] / applet.tcl
index 0b0fcf6847807681008ca6a0bb7b50de73e4678e..5c6ad29c44e1f55e7ef053f6a727094337325d0b 100644 (file)
@@ -2,6 +2,8 @@
 #----- general machinery -----
 
 package require tktray
+#load /home/ian/things/Systray/tktray-1.3.8/libtktray1.3.8.so
+
 
 wm withdraw .
 
@@ -37,6 +39,29 @@ proc msel {} {
     set posted 0
 }
 
+proc setupinnerwindow {} {
+    global innerwindow_after innerwindow
+    catch { after cancel $innerwindow_after }
+    catch { unset innerwindow_after }
+    if {[info exists innerwindow]} return
+    set children {}
+    foreach child [winfo children .i] {
+       if {![winfo exists $child]} continue
+       lappend children $child
+    }
+    if {[llength $children]==1} {
+       set innerwindow [lindex $children 0]
+       bind $innerwindow <Destroy> {
+           innerwindow-unavailable
+           catch { unset innerwindow }
+           after idle setupinnerwindow
+       }
+       innerwindow-available
+    } else {
+       after 5000 setupinnerwindow
+    }
+}
+
 bind .i <ButtonPress> { pressed %b %X %Y }
 
 proc tooltip_starttimer {state x y} {