Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

added support to use other docks in qtile #211

Merged
merged 2 commits into from

2 participants

@Roger

Added support to use other docks in qtile

@Roger Roger added support to use other docks in qtile
It adds and removes gaps when strut is set in the window and makes the
docks static
39f71ce
@tych0
Owner

Hi Roger, it looks like this patch causes some of the unit tests to go haywire. Can you give it a look?

@Roger

now all tests pass =)

Ran 157 tests in 87.717s
OK

@tych0 tych0 merged commit 15f99ae into qtile:develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 19, 2012
  1. @Roger

    added support to use other docks in qtile

    Roger authored
    It adds and removes gaps when strut is set in the window and makes the
    docks static
Commits on Nov 23, 2012
  1. @Roger
This page is out of date. Refresh to see the latest.
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
37 libqtile/manager.py
@@ -978,12 +978,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()
@@ -1005,7 +1035,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
16 libqtile/window.py
@@ -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
@@ -568,6 +569,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
@@ -590,6 +592,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
1  libqtile/xcbq.py
@@ -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),
Something went wrong with that request. Please try again.