From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Mon Jan 26 2009 - 12:13:13 CST

On Sun, 25 Jan 2009, Axel Kohlmeyer wrote:

JT> On Sun, 25 Jan 2009, JT wrote:
JT>
JT> JT> Hi. Is this capability in VMD 1.8.6?
JT>
JT> no.
JT>
JT> features get added to VMD based on demand, feasability,
JT> usefulness, and available workforce.
JT>
JT> but you don't really need this to be implemented into VMD.
JT> Window names are manipulated by window managers and there
JT> is a regular X protocal to deal with it.
JT>
JT> thus you'll get the desired effect if you type something like:
JT>
JT> xprop -name "VMD 1.8.6 OpenGL Display" -set WM_NAME "My VMD Window"
JT>
JT> i leave the implementation into the vmd startup script to you...

hi again,

this was too interesting to not try it myself. so i hacked a little
bit last night and expanded the functionality a little more.
putting the following into your .vmdrc schould automatically
change the name of the display window to include the "name" of
the current top molecule whenever a molecule is loaded or deleted.
you can also use vmd_change_opengl_name directly to change the
name to anything you want, and if you want to stop the automatic
renaming, you only have to set vmd_opengl_wid to -1 or remove
the trace on vmd_molecule.

cheers,
    axel.

p.s.: i forgot to mention. this uses X server commands and thus
will not work on windows, of course... (but who cares ;-) ).

#############################3

# change name of the VMD OpenGL window to the name of the last molecule loaded.
set vmd_opengl_wid -1
global vmd_opengl_wid

proc vmd_change_opengl_name {args} {
    global vmd_opengl_wid

    if {[llength $args] == 0} {
        set name [join [molinfo top get name]]
    } else {
        set name [lindex $args 0]
        if { [string equal $name vmd_molecule] } {
            set name [join [molinfo top get name]]
        }
    }
    if {$vmd_opengl_wid > 0} {
        catch {exec xprop -id $vmd_opengl_wid \
            -set WM_NAME "VMD: $name"}
        catch {exec xprop -id $vmd_opengl_wid \
            -set WM_ICON_NAME $name}
    }
}
trace variable vmd_molecule w vmd_change_opengl_name

after idle {
    global vmd_opengl_wid
    if {![catch {exec xwininfo -name \
            "VMD [vmdinfo version] OpenGL Display"} val ]} {
        set vmd_opengl_wid [lindex $val 3]
    }
    vmd_change_opengl_name
}

#######################

JT>
JT> cheers,
JT> axel.
JT>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.