From 52b564797d474d7f23c0fa827e6cc80d66c3f2dd Mon Sep 17 00:00:00 2001 From: travis Date: Wed, 22 Jul 2015 12:10:12 -0700 Subject: [PATCH 1/5] fixing the gap without all the changes that I made to track the program in fix_gap --- quicktile.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/quicktile.py b/quicktile.py index 2ebf3e4..8d64254 100755 --- a/quicktile.py +++ b/quicktile.py @@ -725,7 +725,16 @@ 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) + gdk_window = gtk.gdk.window_foreign_new(win.get_xid()) + if new_y == 0: + logging.debug("RESIZING") + gdk_window.resize(800, 900) + gdk_window.move(new_x, new_y) + 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 From db962a79e82bd84033f62a5ba44eab9d57aa8aee Mon Sep 17 00:00:00 2001 From: travis Date: Wed, 22 Jul 2015 12:13:51 -0700 Subject: [PATCH 2/5] seems to be working --- quicktile.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/quicktile.py b/quicktile.py index 8d64254..c0e5835 100755 --- a/quicktile.py +++ b/quicktile.py @@ -581,6 +581,9 @@ 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. + + # 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 @@ -727,11 +730,14 @@ def reposition(cls, win, geom=None, monitor=gtk.gdk.Rectangle(0, 0, 0, 0), # gravities have no effect. I'm guessing something's just broken. #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 gdk_window = gtk.gdk.window_foreign_new(win.get_xid()) if new_y == 0: logging.debug("RESIZING") gdk_window.resize(800, 900) 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, From b9fe64a962b37bd558c2ebccb956d06c52348404 Mon Sep 17 00:00:00 2001 From: travis Date: Thu, 23 Jul 2015 11:11:12 -0700 Subject: [PATCH 3/5] added a global variable unity_hack_g that reads a config variable unity_hack. unity_hack_g conditionally alters window placement in unity to remove space between top of window and top menu bar. Note that unity has keypad combo alt + ctrl + numpad to duplicate much of quicktile functionality, except for various sizings --- quicktile.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/quicktile.py b/quicktile.py index c0e5835..1289ff9 100755 --- a/quicktile.py +++ b/quicktile.py @@ -531,7 +531,7 @@ def get_workarea(self, monitor, ignore_struts=False): the most expressive method the window manager supports. @param monitor: The number or dimensions of the desired monitor. - @param ignore_struts: If C{True}, just return the size of the whole + @param ignore_ststrutruts: If C{True}, just return the size of the whole monitor, allowing windows to overlap panels. @type monitor: C{int} or C{gtk.gdk.Rectangle} @type ignore_struts: C{bool} @@ -582,8 +582,9 @@ def get_workarea(self, monitor, ignore_struts=False): # http://standards.freedesktop.org/wm-spec/1.5/ar01s05.html # XXX: Must not cache unless watching for notify events. - # a hack to eliminate the offset from the top bar - g[2] = 0 + 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 @@ -731,14 +732,16 @@ def reposition(cls, win, geom=None, monitor=gtk.gdk.Rectangle(0, 0, 0, 0), #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 - gdk_window = gtk.gdk.window_foreign_new(win.get_xid()) - if new_y == 0: - logging.debug("RESIZING") - gdk_window.resize(800, 900) + # 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) + # 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) @@ -1179,6 +1182,7 @@ def workspace_send_window(wm, win, state, motion): # pylint: disable=W0613 #} if __name__ == '__main__': + travis_var = True from optparse import OptionParser, OptionGroup parser = OptionParser(usage="%prog [options] [action] ...", version="%%prog v%s" % __version__) @@ -1270,6 +1274,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) From 7ad307a6c1034b1ce5c3e1888d2bd124e0f72009 Mon Sep 17 00:00:00 2001 From: travis Date: Thu, 23 Jul 2015 11:17:39 -0700 Subject: [PATCH 4/5] added a global variable unity_hack_g that reads a config variable unity_hack. unity_hack_g conditionally alters window placement in unity to remove space between top of window and top menu bar. Note that unity has keypad combo alt + ctrl + numpad to duplicate much of quicktile functionality, except for various sizings --- quicktile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/quicktile.py b/quicktile.py index 1289ff9..59663e3 100755 --- a/quicktile.py +++ b/quicktile.py @@ -1182,7 +1182,6 @@ def workspace_send_window(wm, win, state, motion): # pylint: disable=W0613 #} if __name__ == '__main__': - travis_var = True from optparse import OptionParser, OptionGroup parser = OptionParser(usage="%prog [options] [action] ...", version="%%prog v%s" % __version__) From a0943ef2f47dd10202f1682acc596600a407d9e4 Mon Sep 17 00:00:00 2001 From: travis Date: Thu, 23 Jul 2015 11:20:04 -0700 Subject: [PATCH 5/5] added a global variable unity_hack_g that reads a config variable unity_hack. unity_hack_g conditionally alters window placement in unity to remove space between top of window and top menu bar. Note that unity has keypad combo alt + ctrl + numpad to duplicate much of quicktile functionality, except for various sizings --- quicktile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quicktile.py b/quicktile.py index 59663e3..82efab8 100755 --- a/quicktile.py +++ b/quicktile.py @@ -531,7 +531,7 @@ def get_workarea(self, monitor, ignore_struts=False): the most expressive method the window manager supports. @param monitor: The number or dimensions of the desired monitor. - @param ignore_ststrutruts: If C{True}, just return the size of the whole + @param ignore_struts: If C{True}, just return the size of the whole monitor, allowing windows to overlap panels. @type monitor: C{int} or C{gtk.gdk.Rectangle} @type ignore_struts: C{bool}