Posted to tcl by patthoyts at Wed Apr 09 13:25:58 GMT 2008view pretty

# Use the Extended Window Manager Hints properties to find out the
# name of the current window manager.
proc get_wm_name {} {
    set result {}
    set atom _NET_SUPPORTING_WM_CHECK
    if {![catch {exec xprop -root -f $atom 32x " \$0+" $atom} check]} {
        set wid [lindex $check 1]
        set atom _NET_WM_NAME
        if {![catch {exec xprop -id $wid -f $atom 8t " \$0+" $atom} name]} {
            set result [lindex $name 1]
        }
    }
    return $result
}