justTony / pytyle

Automatically exported from code.google.com/p/pytyle
GNU General Public License v3.0
0 stars 0 forks source link

PyTyle will not start up if a window is visible on all desktops in Openbox #7

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When I try to run ./pytyle2 with the latest source checked out with mercurial, 
I get an error message if I have a window set to display on all desktops. I'm 
using Openbox 3.4.11.2 on Gentoo. I have attached a patch which resolves the 
problem for me.

What steps will reproduce the problem?

1. Make a window visible on all desktops (right-click title bar > Send to 
desktop > All desktops)
2. Run ./pytyle2

Error message:

  File "/home/ross/src/pytyle/pt/window.py", line 215, in update_monitor
    workspace = Workspace.WORKSPACES[self.properties['_NET_WM_DESKTOP']]
KeyError: 'all'

Printing the value of self.properties['_NET_WM_DESKTOP'], it was in fact
the string 'all' at this point. The window being inspected was the "All
desktops" window.

The X standard says that if _NET_WM_DESKTOP is 0xFFFFFFFF, then the
window should appear on all desktops. I looked in pt/ptxcb to find where
this value might get translated to the string 'all'. At line 174 in
pt/ptxcb/window.py (get_desktop_number), 0xFFFFFFFF is special-cased
into the string 'all'.

I have attached a patch that adds code in pt/window.py to handle this
special case. If the current desktop for a window is 'all', then its
workspace will be on XROOT's current desktop.

Original issue reported on code.google.com by rsha...@gmail.com on 3 Feb 2011 at 3:51

Attachments:

GoogleCodeExporter commented 8 years ago
the issue isn't about starting it with open windows per se. if you start pytyle 
in advance, and then put a window on all desktops, pytyle will crash.

Traceback (most recent call last):
  File "/usr/bin/pytyle2", line 59, in <module>
    d = Dispatcher(event_data)
  File "/usr/lib64/python2.7/site-packages/pt/dispatcher.py", line 20, in __init__
    getattr(self, self._event_data['event'])()
  File "/usr/lib64/python2.7/site-packages/pt/dispatcher.py", line 95, in PropertyNotifyEvent
    win.update_property(a)
  File "/usr/lib64/python2.7/site-packages/pt/window.py", line 233, in update_property
    m()
  File "/usr/lib64/python2.7/site-packages/pt/window.py", line 249, in update_NET_WM_DESKTOP
    self.update_monitor()
  File "/usr/lib64/python2.7/site-packages/pt/window.py", line 223, in update_monitor
    workspace = Workspace.WORKSPACES[self.properties['_NET_WM_DESKTOP']]
KeyError: 'all'

curiously, this does not hold true for below-layered windows - only 
normal-layered windows.

Original comment by alexande...@gmail.com on 14 Apr 2011 at 12:46