From 8aae370bf8a6692c1f791699fb6001e7f4d900fc Mon Sep 17 00:00:00 2001 From: TobiZog Date: Mon, 24 Jul 2023 23:22:16 +0200 Subject: [PATCH] Adding option to stretch the image over multiple displays --- CHANGELOG | 3 + README.md | 17 +++--- .../5.4/extension.js | 59 ++++++++++++++----- .../5.4/settings-schema.json | 8 ++- 4 files changed, 62 insertions(+), 25 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 08d7936..2218fa4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +# Version 1.3 +- Adding option to stretch the image over multiple displays + # Version 1.2 - Compatibility with Cinnamon 4.8 and higher - Notification on first start diff --git a/README.md b/README.md index b70e899..dfd576a 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Based on a location, this extension calculates the periods of a day and switches - Image configuration assistent with simple one-click setup for image choose - Online location estimation or offline with manual latitude and longitude input - Offline sun angles estimation +- Image stretching over multiple displays or repeat image for every display ### Tested Cinnamon versions - 4.8 (Mint 20.1) @@ -30,11 +31,6 @@ Based on a location, this extension calculates the periods of a day and switches - Image Configurator UI was written with `Glade` ## Installation -### From the repo -1. Download the Repository -2. Extract the files -3. Copy the folder `cinnamon-dynamic-wallpaper@TobiZog` to `~/.local/share/cinnamon/extensions/` - ### From Built-in Extension Manager ![](res/download-manager.png) @@ -42,6 +38,11 @@ Based on a location, this extension calculates the periods of a day and switches 2. Click on "Download" 3. Search and download it +### From the repo +1. Download the Repository +2. Extract the files +3. Copy the folder `cinnamon-dynamic-wallpaper@TobiZog` to `~/.local/share/cinnamon/extensions/` + ## How to use it 1. Active the Extension via Cinnamon Extension Manager 2. Open the settings @@ -59,12 +60,12 @@ The image sets are from https://github.com/adi1090x/dynamic-wallpaper | Aurora | Beach | Bitday | | ------ | ----- | ------ | -| ![](cinnamon-dynamic-wallpaper@TobiZog/images/included_image_sets/aurora/5.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/images/included_image_sets/beach/4.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/images/included_image_sets/bitday/4.jpg) | +| ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/images/included_image_sets/aurora/5.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/images/included_image_sets/beach/4.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/images/included_image_sets/bitday/4.jpg) | | Cliffs | Gradient | Lakeside | | -------- | --------- | ------ | -| ![](cinnamon-dynamic-wallpaper@TobiZog/images/included_image_sets/cliffs/4.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/images/included_image_sets/gradient/4.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/images/included_image_sets/lakeside/4.jpg) | +| ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/images/included_image_sets/cliffs/4.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/images/included_image_sets/gradient/4.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/images/included_image_sets/lakeside/4.jpg) | | Mountains | Sahara | | --------- | ------ | -| ![](cinnamon-dynamic-wallpaper@TobiZog/images/included_image_sets/mountains/4.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/images/included_image_sets/sahara/4.jpg) | \ No newline at end of file +| ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/images/included_image_sets/mountains/4.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/images/included_image_sets/sahara/4.jpg) | \ No newline at end of file diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/extension.js b/cinnamon-dynamic-wallpaper@TobiZog/5.4/extension.js index c893cb4..9f21799 100644 --- a/cinnamon-dynamic-wallpaper@TobiZog/5.4/extension.js +++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/extension.js @@ -58,21 +58,30 @@ CinnamonDynamicWallpaperExtension.prototype = { _init: function(uuid) { this.settings = new Settings.ExtensionSettings(this, uuid); - this.bindSettings("sw_auto_location", "autolocation", this.updateLocation) - this.bindSettings("sc_location_refresh_time", "locationRefreshTime") - this.bindSettings("etr_latitude", "latitude", this.updateLocation) - this.bindSettings("etr_longitude", "longitude", this.updateLocation) - this.bindSettings("etr_img_morning_twilight", "img_morning_twilight", this.setImageToTime) - this.bindSettings("etr_img_sunrise", "img_sunrise", this.setImageToTime) - this.bindSettings("etr_img_morning", "img_morning", this.setImageToTime) - this.bindSettings("etr_img_noon", "img_noon", this.setImageToTime) - this.bindSettings("etr_img_afternoon", "img_afternoon", this.setImageToTime) - this.bindSettings("etr_img_evening", "img_evening", this.setImageToTime) - this.bindSettings("etr_img_sunset", "img_sunset", this.setImageToTime) - this.bindSettings("etr_img_night_twilight", "img_night_twilight", this.setImageToTime) - this.bindSettings("etr_img_night", "img_night", this.setImageToTime) + // Image set + this.bindSettings("sw_image_stretch", "imageStretch", this.settingsUpdated) + + // Location estimation + this.bindSettings("sw_auto_location", "autolocation", this.settingsUpdated) + this.bindSettings("sc_location_refresh_time", "locationRefreshTime", this.settingsUpdated) + this.bindSettings("etr_latitude", "latitude", this.settingsUpdated) + this.bindSettings("etr_longitude", "longitude", this.settingsUpdated) + + // Time periods this.bindSettings("tv_times", "tvTimes") + // Image Configurator + this.bindSettings("etr_img_morning_twilight", "img_morning_twilight", this.settingsUpdated) + this.bindSettings("etr_img_sunrise", "img_sunrise", this.settingsUpdated) + this.bindSettings("etr_img_morning", "img_morning", this.settingsUpdated) + this.bindSettings("etr_img_noon", "img_noon", this.settingsUpdated) + this.bindSettings("etr_img_afternoon", "img_afternoon", this.settingsUpdated) + this.bindSettings("etr_img_evening", "img_evening", this.settingsUpdated) + this.bindSettings("etr_img_sunset", "img_sunset", this.settingsUpdated) + this.bindSettings("etr_img_night_twilight", "img_night_twilight", this.settingsUpdated) + this.bindSettings("etr_img_night", "img_night", this.settingsUpdated) + + // Check for the first startup if (this.settings.getValue("first_start")) { // Welcome notification @@ -118,6 +127,18 @@ CinnamonDynamicWallpaperExtension.prototype = { ) }, + + /** + * Handles changes in settings + */ + settingsUpdated: function() { + lastDayTime = suntimes.DAYPERIOD.NONE + + this.updateLocation() + this.setImageToTime() + }, + + /** * Displaying a desktop notification * @@ -165,6 +186,15 @@ CinnamonDynamicWallpaperExtension.prototype = { changeWallpaper: function(imageURI) { let gSetting = new Gio.Settings({schema: 'org.cinnamon.desktop.background'}); gSetting.set_string('picture-uri', imageURI); + + if (this.imageStretch) { + gSetting.set_string('picture-options', 'spanned') + } + else + { + gSetting.set_string('picture-options', 'zoom') + } + Gio.Settings.sync(); gSetting.apply(); }, @@ -229,9 +259,6 @@ CinnamonDynamicWallpaperExtension.prototype = { this.longitude = this.longitude } - // Refresh the image information, if it's necessary - this.setImageToTime() - // Update the update information lastLocationUpdate = new Date() }, diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/settings-schema.json b/cinnamon-dynamic-wallpaper@TobiZog/5.4/settings-schema.json index 7fc3feb..ac698b8 100644 --- a/cinnamon-dynamic-wallpaper@TobiZog/5.4/settings-schema.json +++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/settings-schema.json @@ -30,7 +30,8 @@ "title": "Image set", "keys": [ "lb_image_configuration", - "btn_config_images" + "btn_config_images", + "sw_image_stretch" ] }, "sec_location": { @@ -88,6 +89,11 @@ "description": "Image Configurator", "callback": "openImageConfigurator" }, + "sw_image_stretch": { + "type": "switch", + "description": "Expand image over all displays", + "default": true + }, "sw_auto_location": { "type": "switch", "default": true,