Adding option to stretch the image over multiple displays
This commit is contained in:
@@ -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()
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user