diff --git a/quicktile.py b/quicktile.py index 2ebf3e4..82efab8 100755 --- a/quicktile.py +++ b/quicktile.py @@ -581,6 +581,10 @@ def get_workarea(self, monitor, ignore_struts=False): for g in struts: # http://standards.freedesktop.org/wm-spec/1.5/ar01s05.html # XXX: Must not cache unless watching for notify events. + + if unity_hack_g: # a hack to eliminate the offset from the top bar + g[2] = 0 + _Su(0, g[4], g[0], g[5] - g[4] + 1) # left _Su(_w - g[1], g[6], g[1], g[7] - g[6] + 1) # right _Su(g[8], 0, g[9] - g[8] + 1, g[2]) # top @@ -725,7 +729,21 @@ def reposition(cls, win, geom=None, monitor=gtk.gdk.Rectangle(0, 0, 0, 0), # # ...however, that still doesn't explain why the non-topleft # gravities have no effect. I'm guessing something's just broken. - win.set_geometry(wnck.WINDOW_GRAVITY_STATIC, geometry_mask, + #win.set_geometry(wnck.WINDOW_GRAVITY_STATIC, geometry_mask, + # new_x, new_y, geom.width, geom.height) + + # a hack to eliminate the gap at the top for windows in unity + if unity_hack_g and new_y == 0: + gdk_window = gtk.gdk.window_foreign_new(win.get_xid()) + monitor_id = wm.gdk_screen.get_monitor_at_window(gdk_window) + monitor_geom = wm.gdk_screen.get_monitor_geometry(monitor_id) + gdk_window.resize(geom.width, monitor_geom.height) + gdk_window.move(new_x, new_y) + # the -40 is to adjust for the + # window menu bar size for terminal windows. + gdk_window.resize(geom.width, geom.height - 40) + else: + win.set_geometry(wnck.WINDOW_GRAVITY_STATIC, geometry_mask, new_x, new_y, geom.width, geom.height) # Restore maximization if asked @@ -1255,6 +1273,12 @@ def workspace_send_window(wm, win, state, motion): # pylint: disable=W0613 ignore_workarea = ((not config.getboolean('general', 'UseWorkarea')) or opts.no_workarea) + # unity_hack eliminates space between window and top menu bar + if not config.has_option('general', 'unity_hack'): + unity_hack_g = False + else: + unity_hack_g = config.getboolean('general', 'unity_hack') + wm = WindowManager(ignore_workarea=ignore_workarea) app = QuickTileApp(wm, commands, keymap, modmask=modkeys)