Skip to content

Commit

Permalink
tentative fix for #24
Browse files Browse the repository at this point in the history
  • Loading branch information
GabMus committed Mar 1, 2018
1 parent 02c0711 commit 88db8e2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
7 changes: 5 additions & 2 deletions hydrapaper/monitor_parser.py
Expand Up @@ -4,9 +4,10 @@

class Monitor:

def __init__(self, width, height, offset_x, offset_y, index, name, primary=False):
def __init__(self, width, height, scaling, offset_x, offset_y, index, name, primary=False):
self.width = int(width)
self.height = int(height)
self.scaling = int(scaling)
self.primary = primary
self.offset_x = int(offset_x)
self.offset_y = int(offset_y)
Expand All @@ -19,9 +20,10 @@ def __repr__(self):
HydraPaper Monitor Object
- Name: {};
- Resolution: {} x {};
- Scaling: {}
- Offset: {} x {};
- Wallpaper path: {};
'''.format(self.name, self.width, self.height, self.offset_x, self.offset_y, self.wallpaper)
'''.format(self.name, self.width, self.height, self.scaling, self.offset_x, self.offset_y, self.wallpaper)

def build_monitors_from_gdk():
monitors = []
Expand All @@ -34,6 +36,7 @@ def build_monitors_from_gdk():
monitors.append(Monitor(
monitor_rect.width,
monitor_rect.height,
monitor.get_scale_factor(),
monitor_rect.x,
monitor_rect.y,
i,
Expand Down
31 changes: 26 additions & 5 deletions hydrapaper/wallpaper_merger.py
Expand Up @@ -12,11 +12,32 @@ def multi_setup_pillow(monitors, save_path, wp_setter_func=None):
# detect if setup is vertical or horizontal

images = list(map(Image.open, [m.wallpaper for m in monitors]))
resolutions = [(m.width, m.height) for m in monitors]
widths = [r[0] for r in resolutions]
heights = [r[1] for r in resolutions]
offsets = [(m.offset_x, m.offset_y) for m in monitors]
offsets_x, offsets_y = [o[0] for o in offsets], [o[1] for o in offsets]
highest_scaling = max([m.scaling for m in monitors])
# resolutions = [(m.width, m.height) for m in monitors]
# widths, heights = [r[0] for r in resolutions], [r[1] for r in resolutions]
# offsets = [(m.offset_x, m.offset_y) for m in monitors]
# offsets_x, offsets_y = [o[0] for o in offsets], [o[1] for o in offsets]

resolutions = []
widths = []
heights = []
offsets = []
offsets_x = []
offsets_y = []
for m in monitors:
if m.scaling == highest_scaling:
resolutions.append((m.width/highest_scaling, m.height/highest_scaling))
widths.append(m.width/highest_scaling)
heights.append(m.height/highest_scaling)
offsets.append((m.offset_x/highest_scaling, m.offset_y/highest_scaling))
offsets_x.append(m.offset_x/highest_scaling)
offsets_y.append(m.offset_y/highest_scaling)
else:
resolutions.append((m.width*highest_scaling, m.height*highest_scaling)) widths.append(m.width*highest_scaling)
heights.append(m.height*highest_scaling)
offsets.append((m.offset_x*highest_scaling, m.offset_y*highest_scaling))
offsets_x.append(m.offset_x*highest_scaling)
offsets_y.append(m.offset_y*highest_scaling)

# calculate new wallpaper size

Expand Down

0 comments on commit 88db8e2

Please sign in to comment.