Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing gap at top of windows between top menu bar #55

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion quicktile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down