Permalink
Browse files

Merge pull request #211 from Roger/external_docs

added support to use other docks in qtile
  • Loading branch information...
2 parents b58514d + 86ec9a5 commit 15f99ae434b928498ee7a51890673238bbd33a60 @tych0 tych0 committed Nov 24, 2012
Showing with 53 additions and 1 deletion.
  1. +36 −1 libqtile/manager.py
  2. +16 −0 libqtile/window.py
  3. +1 −0 libqtile/xcbq.py
View
@@ -995,12 +995,42 @@ def unmanage(self, win):
c = self.windowMap.get(win)
if c:
hook.fire("client_killed", c)
+ self.reset_gaps(c)
if getattr(c, "group", None):
c.window.unmap()
c.state = window.WithdrawnState
c.group.remove(c)
del self.windowMap[win]
+ def reset_gaps(self, c):
+ if c.strut:
+ self.update_gaps((0, 0, 0, 0), c.strut)
+
+ def update_gaps(self, strut, old_strut=None):
+ from libqtile.bar import Gap
+
+ (left, right, top, bottom) = strut[:4]
+ if old_strut:
+ (old_left, old_right, old_top, old_bottom) = old_strut[:4]
+ if not left and old_left:
+ self.currentScreen.left = None
+ elif not right and old_right:
+ self.currentScreen.right = None
+ elif not top and old_top:
+ self.currentScreen.top = None
+ elif not bottom and old_bottom:
+ self.currentScreen.bottom = None
+
+ if top:
+ self.currentScreen.top = Gap(top)
+ elif bottom:
+ self.currentScreen.bottom = Gap(bottom)
+ elif left:
+ self.currentScreen.left = Gap(left)
+ elif right:
+ self.currentScreen.right = Gap(right)
+ self.currentScreen.resize()
+
def manage(self, w):
try:
attrs = w.get_attributes()
@@ -1022,7 +1052,12 @@ def manage(self, w):
c = window.Window(w, self)
except (xcb.xproto.BadWindow, xcb.xproto.BadAccess):
return
- hook.fire("client_new", c)
+
+ if w.get_wm_type() == "dock" or c.strut:
+ c.static(self.currentScreen.index)
+ else:
+ hook.fire("client_new", c)
+
# Window may be defunct because
# it's been declared static in hook.
if c.defunct:
View
@@ -125,6 +125,7 @@ def __init__(self, window, qtile):
self.borderwidth = 0
self.bordercolor = None
self.name = "<no name>"
+ self.strut = None
self.state = NormalState
self.window_type = "normal"
self._float_state = NOT_FLOATING
@@ -579,6 +580,7 @@ def __init__(self, win, qtile, screen,
self.screen = screen
if None not in (x, y, width, height):
self.place(x, y, width, height, 0, 0)
+ self.update_strut()
def handle_ConfigureRequest(self, e):
cw = xcb.xproto.ConfigWindow
@@ -601,6 +603,20 @@ def handle_ConfigureRequest(self, e):
)
return False
+ def update_strut(self):
+ strut = self.window.get_property("_NET_WM_STRUT_PARTIAL", unpack="I"*12)
+ if not strut:
+ strut = self.window.get_property("_NET_WM_STRUT", unpack="I"*4)
+ if not strut:
+ strut = (0, 0, 0, 0)
+ self.qtile.update_gaps(strut, self.strut)
+ self.strut = strut
+
+ def handle_PropertyNotify(self, e):
+ name = self.qtile.conn.atoms.get_name(e.atom)
+ if name in ("_NET_WM_STRUT_PARTIAL", "_NET_WM_STRUT"):
+ self.update_strut()
+
def __repr__(self):
return "Static(%s)" % self.name
View
@@ -108,6 +108,7 @@ def ConfigureWindow(self, window, value_mask, value_list):
"_NET_ACTIVE_WINDOW": ("WINDOW", 32),
"_NET_WM_STATE": ("ATOM", 32),
"_NET_WM_DESKTOP": ("CARDINAL", 32),
+ "_NET_WM_STRUT": ("CARDINAL", 32),
"_NET_WM_STRUT_PARTIAL": ("CARDINAL", 32),
"_NET_WM_WINDOW_OPACITY": ("CARDINAL", 32),
"_NET_WM_WINDOW_TYPE": ("CARDINAL", 32),

0 comments on commit 15f99ae

Please sign in to comment.