Skip to content

Commit

Permalink
Fix #704: In "smart" display mode, tile small wallpapers using ImageM…
Browse files Browse the repository at this point in the history
…agick (#727)

In "smart" display mode, tile small wallpapers using ImageMagick rather than relying on the system's wallpaper tiling mode.  For this display mode, this change works around a [long-standing issue](#704) with GNOME's `wallpaper` tiling mode. https://gitlab.gnome.org/GNOME/mutter/-/issues/1473
  • Loading branch information
peteroupc authored Jan 8, 2025
1 parent f4dccc8 commit fa68b00
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"-resize %Wx%H^ -gravity center -extent %Wx%H -scale 10% -blur 0x3 -resize 1000% -clone 0 "
"-resize %Wx%H -size %Wx%H -gravity center -composite"
)

IMAGEMAGICK_TILE = "-write mpr:x -delete -1 -size %Wx%H tile:mpr:x "

def _smart_fn(filename):
try:
Expand All @@ -23,7 +23,10 @@ def _smart_fn(filename):
total_w, total_h = Util.get_multimonitor_display_size()
if image_w * image_h * 10 < primary_w * primary_h:
# image way smaller than primary monitor, tile it
return DisplayModeData(set_wallpaper_param="wallpaper")
cmd = IMAGEMAGICK_TILE.replace("%W", str(primary_w)).replace(
"%H", str(primary_h)
)
return DisplayModeData(set_wallpaper_param="zoom", imagemagick_cmd=cmd)
else:
image_ratio = image_w / image_h
primary_ratio = primary_w / primary_h
Expand Down Expand Up @@ -63,7 +66,7 @@ def display_modes(self) -> List[DisplayMode]:
"Variety uses the fast OS-provided Zoom mode for images that are close to "
"screen proportions, uses 'Fit & pad with a blurred background' when the image "
"proportions are significantly different - e.g. portraits on a horizontal "
"screen, and uses the OS-provided tiling mode for very small images that would "
"screen, and uses a screen-covering tiling of the image if it is very small such that it would "
"look bad resized."
),
fn=_smart_fn,
Expand Down

0 comments on commit fa68b00

Please sign in to comment.