Close other window via pyxfce

Jamie Guinan guinan at bluebutton.com
Thu Aug 7 21:11:50 CEST 2008


Hi,

I'm running gentoo, with,

  xfce4-4.4.2
  pyxfce-4.4.0

I wanted to search for and close a window from a script, and
pyxfce looked like a nice easy way to do this.

I run "thunar /tmp" from the shell, and I get a Thunar window with
title "tmp - File Manager".

Then I try the following,

#!/usr/bin/python
import xfce4.netk
s = xfce4.netk.screen_get_default()
for w in s.get_windows():
  if w.get_name().startswith('tmp'):
    w.close()
    # w.minimize()

But it doesn't close the window like I would expect.  .minimize(),
which is commented out above, *does* work, though, so I think
I have a handle on the right object.

Is there something else I need to do to get the window to close?

-Jamie



More information about the Xfce4-dev mailing list