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

Corners don't work #8

Open
wants to merge 2 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
40 changes: 26 additions & 14 deletions gnome-shell-grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ def unmaximize(func):
def wrapper(w, *args):
if w.is_maximized():
w.unmaximize()
return func(*args)
return func(w, *args)
return wrapper

def close(a, b):
v = sum((x-y)**2 for (x, y) in zip(a, b))
return v < 200
return v < 400

def cycle(func):
def wrapper(w, (width, height), window_size):
Expand All @@ -34,47 +34,59 @@ def full(w, (width, height), window_size):
return 0, 0, width, height

@unmaximize
def top((width, height), window_size):
return 0, 0, width, height / 2

@cycle
def top((width, height)):
height_cycle = [height / 2, int(height/1.5), height/3]
return [(0, 0, width, cycle)
for cycle in height_cycle]

@unmaximize
@cycle
def top_right((width, height)):
height = height / 2
width_cycle = [width / 2, int(width / 1.5), width / 3]
return [(width-cycle, 0, cycle, height)
for cycle in width_cycle]

@unmaximize
def right((width, height), window_size):
return width / 2, 0, width / 2, height

@cycle
def right((width, height)):
width_cycle = [width / 2, int(width / 1.5), width / 3]
return [(width-cycle, 0, cycle, height)
for cycle in width_cycle]

@unmaximize
@cycle
def bottom_right((width, height)):
height = height / 2
width_cycle = [width / 2, int(width / 1.5), width / 3]
return [(width-cycle, height, cycle, height)
for cycle in width_cycle]

@unmaximize
def bottom((width, height), window_size):
return 0, height / 2, width, height / 2

@cycle
def bottom((width, height)):
height_cycle = [height / 2, int(height/1.5), height/3]
return [(0, height-cycle, width, cycle)
for cycle in height_cycle]

@unmaximize
@cycle
def bottom_left((width, height)):
height = height / 2
width_cycle = [width / 2, int(width / 1.5), width / 3]
return [(0, height, cycle, height)
for cycle in width_cycle]

@unmaximize
def left((width, height), window_size):
return 0, 0, width / 2, height

@cycle
def left((width, height)):
width_cycle = [width / 2, int(width / 1.5), width / 3]
return [(0, 0, cycle, height)
for cycle in width_cycle]

@unmaximize
@cycle
def top_left((width, height)):
height = height / 2
width_cycle = [width / 2, int(width / 1.5), width / 3]
Expand Down