I am trying to build a panel application, alike avant window navigator or ubuntu unity.
My question is once I build the panel with the predifined applications, how I can add items to the panel when applications are open or launch?
Here is my source code in tcl:
package require Tk
set items {xterm gvim firefox}
wm withdraw .
toplevel .panel
wm attributes .panel -topmost 1 ; # on top
bind .panel <Escape> {exit}
wm geometry .panel +0+0
wm overrideredirect .panel yes ; # remove window decorations
set counter 0
foreach item $items {
incr counter
set separator " "
label .panel.$counter -text "$item$separator" -bg black -fg white \
-font {-family "Fixedsys Excelsior 3.01" -size 12}
grid .panel.$counter -column $counter -row 0
}
Is there any terminal, tcl or python command that can achieve this?
Appreciate any insights. Thank you in advance.
If the
send
command is turned on (which depends on all sorts of factors related to the security of your display) you can just tell it to listen on a “well-known name” and then have another little app usesend
to dispatch a script to evaluate.In the panel, listen on a “good” name:
In the helper script:
Now you can use that little script from a shell script or wherever to send an instruction to the panel to register something. It's as easy as that.
If the
send
command isn't present, try the comm package in Tcllib, withcomm::comm send
as the approximate equivalent ofsend
. However, there's nothing exactly the same astk appname
as there's no portable way to do a registry of port mappings (comm uses local TCP channels) so you need to find a way to communicate that information (a file in a well-known place?). Alas, I'm not very experienced with it so I can't really advise in detail.