Moving a window between workspaces/virtual desktops

Hi all,
I have a Linux-only wxPython application with a wxFrame that acts as a
menu/toolbar, it can open up new windows that are independent of the
toolbar itself.
Since the user can move any of these windows to any virtual workspace,
I'm looking for a way to move the toolbar to the current workspace
whenever the user activates a window.
I tried using Raise(), but in this way the toolbar receives the focus
too and I don't want that. Please note that I can't make the toolbar
sticky, since I don't want it on every workspace.

Thanks!

(wxPython 2.8.9.1, Ubuntu 9.04)

It probably depends on the Window Manager and how it represents windows on other desktops. IIRC some will just show/hide windows as needed when the active desktop changes, others will alter the position of windows such that they are relocated to the virtual space outside of the physical display area.

Have you tried just using tbarFrame.Show()? If Raise() is showing it on the current desktop then I would think that Show() would also. Otherwise I would try something like tbarFrame.Raise() followed by wx.CallAfter(self.Raise) where self is the window already on the virtual desktop that was just activated. Be sure to watch out for additional activation events and make sure you don't get stuck in an endless event recursion.

···

On 1/25/10 4:57 AM, Joril wrote:

Hi all,
I have a Linux-only wxPython application with a wxFrame that acts as a
menu/toolbar, it can open up new windows that are independent of the
toolbar itself.
Since the user can move any of these windows to any virtual workspace,
I'm looking for a way to move the toolbar to the current workspace
whenever the user activates a window.
I tried using Raise(), but in this way the toolbar receives the focus
too and I don't want that. Please note that I can't make the toolbar
sticky, since I don't want it on every workspace.

--
Robin Dunn
Software Craftsman

Have you tried just using tbarFrame.Show()? If Raise() is showing it on
the current desktop then I would think that Show() would also.

Show() does nothing :confused:

Otherwise I would try something like tbarFrame.Raise() followed by
wx.CallAfter(self.Raise) where self is the window already on the virtual
desktop that was just activated. Be sure to watch out for additional
activation events and make sure you don't get stuck in an endless event
recursion.

I tried using an instance variable to prevent that endless recursion,
like this:

def ensure_visible_toolbar(self, event):
    # Called on wx.EVT_ACTIVATE
    if self.raising_toolbar:
        return;
    self.raising_toolbar = True
    self.toolbar.Raise()
    wx.CallAfter(self.Raise)
    event.Skip()

def Raise(self):
    wx.Frame.Raise(self)
    self.raising_toolbar = False

But somehow the recursion is still there.. Am I missing something
trivial? ^^;

···

On 25 Gen, 19:46, Robin Dunn <ro...@alldunn.com> wrote:

I ended up using wmctrl to handle workspaces.. Thanks all the same!

···

On 26 Gen, 09:33, Joril <jor...@gmail.com> wrote:

But somehow the recursion is still there.. Am I missing something
trivial? ^^;