#!/usr/bin/env php /dev/null"); if ($first != "") { $second = exec("zenity --title=\"Select the second wallpaper\" --file-selection --filename=\"$homeDir/.\" 2>/dev/null"); if ($second != "") { mkdir($tmpDir); if ($debug === TRUE) { echo "Image paths:\n"; echo " First: $first\n"; echo " Second: $second\n"; } $firstTmpPath = $tmpDir."/first"; $secondTmpPath = $tmpDir."/second"; exec("convert -resize $firstSize! \"$first\" png:\"$firstTmpPath\""); exec("convert -resize $secondSize! \"$second\" png:\"$secondTmpPath\""); if ($orientation == "horizontal") exec("convert +append \"$firstTmpPath\" \"$secondTmpPath\" \"$outputFile\""); if ($orientation == "vertical") exec("convert -append \"$firstTmpPath\" \"$secondTmpPath\" \"$outputFile\""); # Actually setting the wallpaper only works in Gnome for now. Sorry :| exec("gconftool-2 -t string -s /desktop/gnome/background/picture_options \"wallpaper\""); # set it to tile exec("gconftool-2 -t string -s /desktop/gnome/background/picture_filename \"$outputFile\""); # set the wallpaper file echo "Remember not to delete $outputFile or you'll lose your wallpapers.\n"; if ($debug === FALSE) { unlink($firstTmpPath); unlink($secondTmpPath); rmdir($tmpDir); } } } } else echo "Usage: $script firstWallpaperSize secondWallpaperSize horizontal|vertical\n"; ?>