Readme, bugfix, documentation
This commit is contained in:
@@ -14,6 +14,9 @@ Based on a location, this extension calculates the periods of a day and switches
|
|||||||
- Offline sun angles estimation
|
- Offline sun angles estimation
|
||||||
|
|
||||||
### Tested Cinnamon versions
|
### Tested Cinnamon versions
|
||||||
|
- 4.8 (Mint 20.1)
|
||||||
|
- 5.0 (Mint 20.2)
|
||||||
|
- 5.2 (Mint 20.3)
|
||||||
- 5.4 (Mint 21)
|
- 5.4 (Mint 21)
|
||||||
- 5.6 (Mint 21.1)
|
- 5.6 (Mint 21.1)
|
||||||
- 5.8 (Mint 21.2)
|
- 5.8 (Mint 21.2)
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
../5.4/icon/icon.png
|
../5.4/icons/icon.png
|
||||||
@@ -73,29 +73,42 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
this.bindSettings("etr_img_night", "img_night", this.setImageToTime)
|
this.bindSettings("etr_img_night", "img_night", this.setImageToTime)
|
||||||
this.bindSettings("tv_times", "tvTimes")
|
this.bindSettings("tv_times", "tvTimes")
|
||||||
|
|
||||||
this.setImageToTime()
|
|
||||||
|
|
||||||
this._loop()
|
|
||||||
|
|
||||||
|
|
||||||
// Check for the first startup
|
// Check for the first startup
|
||||||
if (this.settings.getValue("first_start")) {
|
if (this.settings.getValue("first_start")) {
|
||||||
this.showNotification("Welcome to Cinnamon Dynamic Wallpaper", "Check the preferences to choose a dynamic wallpaper", true)
|
// Welcome notification
|
||||||
|
this.showNotification("Welcome to Cinnamon Dynamic Wallpaper",
|
||||||
|
"Check the preferences to choose a dynamic wallpaper", true)
|
||||||
|
|
||||||
|
// Hide the notification on system restart
|
||||||
this.settings.setValue("first_start", false)
|
this.settings.setValue("first_start", false)
|
||||||
|
|
||||||
// Copy the default wallpaper to the folder
|
// Create the folder for the selected images
|
||||||
Util.spawnCommandLine("mkdir " + DIRECTORY.path + "/images/selected/")
|
Util.spawnCommandLine("mkdir " + DIRECTORY.path + "/images/selected/")
|
||||||
global.log("mkdir " + DIRECTORY.path + "/images/selected")
|
|
||||||
|
|
||||||
|
// Link the default wallpaper to the folder
|
||||||
for (let i = 1; i <= 9; i++) {
|
for (let i = 1; i <= 9; i++) {
|
||||||
Util.spawnCommandLine("ln -s " +
|
Util.spawnCommandLine("ln -s " +
|
||||||
DIRECTORY.path + "/images/included_image_sets/lakeside/" + i + ".jpg " +
|
DIRECTORY.path + "/images/included_image_sets/lakeside/" + i + ".jpg " +
|
||||||
DIRECTORY.path + "/images/selected/" + i + ".jpg");
|
DIRECTORY.path + "/images/selected/" + i + ".jpg");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set image initial at desktop wallpaper
|
||||||
|
this.setImageToTime()
|
||||||
|
|
||||||
|
// Start the main loop, checks in fixed time periods the
|
||||||
|
this._loop()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Binding the settings objects
|
||||||
|
*
|
||||||
|
* @param {*} ui_name Name of preference in settings-schema.json
|
||||||
|
* @param {*} js_name Name of preference in JavaScript
|
||||||
|
* @param {*} func Function to call on change
|
||||||
|
*/
|
||||||
bindSettings: function (ui_name, js_name, func = this.on_settings_changed) {
|
bindSettings: function (ui_name, js_name, func = this.on_settings_changed) {
|
||||||
this.settings.bindProperty(
|
this.settings.bindProperty(
|
||||||
Settings.BindingDirection.IN,
|
Settings.BindingDirection.IN,
|
||||||
@@ -105,13 +118,13 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displaying a desktop notification
|
* Displaying a desktop notification
|
||||||
*
|
*
|
||||||
* @param {string} title The Title in the notification
|
* @param {string} title The Title in the notification
|
||||||
* @param {string} text The text in the notification
|
* @param {string} text The text in the notification
|
||||||
* @param {boolean} showOpenSettings Display the "Open settings" button in the notification, defaults to false
|
* @param {boolean} showOpenSettings Display the "Open settings" button in the notification,
|
||||||
|
* defaults to false
|
||||||
*/
|
*/
|
||||||
showNotification: function (title, text, showOpenSettings = false) {
|
showNotification: function (title, text, showOpenSettings = false) {
|
||||||
let source = new MessageTray.Source(this.uuid);
|
let source = new MessageTray.Source(this.uuid);
|
||||||
@@ -157,7 +170,9 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Estimate the right image based on time period of the day
|
||||||
|
*/
|
||||||
setImageToTime: function() {
|
setImageToTime: function() {
|
||||||
let times = suntimes.calcTimePeriod(this.latitude, this.longitude)
|
let times = suntimes.calcTimePeriod(this.latitude, this.longitude)
|
||||||
let now = new Date()
|
let now = new Date()
|
||||||
@@ -176,7 +191,6 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
|
|
||||||
for(let i = 0; i < timesArray.length; i++) {
|
for(let i = 0; i < timesArray.length; i++) {
|
||||||
if(timesArray[i][0] <= now && now <= timesArray[i][1] && i != lastDayTime) {
|
if(timesArray[i][0] <= now && now <= timesArray[i][1] && i != lastDayTime) {
|
||||||
global.log(PATH + "/res/images/selected/" + imageSet[i])
|
|
||||||
this.changeWallpaper("file://" + PATH + "/images/selected/" + imageSet[i])
|
this.changeWallpaper("file://" + PATH + "/images/selected/" + imageSet[i])
|
||||||
|
|
||||||
lastDayTime = i
|
lastDayTime = i
|
||||||
@@ -201,7 +215,10 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
"\nNight:\t\t\t\t" + convertToTimeString(timesArray[8][0]) + " - " + convertToTimeString(timesArray[8][1])
|
"\nNight:\t\t\t\t" + convertToTimeString(timesArray[8][0]) + " - " + convertToTimeString(timesArray[8][1])
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the location of the user
|
||||||
|
* Callback for changes in preferences
|
||||||
|
*/
|
||||||
updateLocation: function () {
|
updateLocation: function () {
|
||||||
if (this.autolocation) {
|
if (this.autolocation) {
|
||||||
let loc = location.estimateLocation()
|
let loc = location.estimateLocation()
|
||||||
@@ -227,7 +244,8 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
* Opens the external heic-importer window
|
* Opens the external heic-importer window
|
||||||
*/
|
*/
|
||||||
openImageConfigurator: function() {
|
openImageConfigurator: function() {
|
||||||
Util.spawnCommandLine("/usr/bin/env python3 " + DIRECTORY.path + "/image-configurator/image-configurator.py");
|
Util.spawnCommandLine("/usr/bin/env python3 " +
|
||||||
|
DIRECTORY.path + "/image-configurator/image-configurator.py");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@@ -283,13 +301,6 @@ function enable() {
|
|||||||
Util.spawnCommandLine("apturl apt://libheif-examples");
|
Util.spawnCommandLine("apturl apt://libheif-examples");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display the welcome notification on activation
|
|
||||||
// extension.showNotification(
|
|
||||||
// APPNAME,
|
|
||||||
// "Welcome to " + APPNAME + "! Open the settings and configure the extensions.",
|
|
||||||
// true
|
|
||||||
// );
|
|
||||||
|
|
||||||
return extension;
|
return extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
icon/icon.png
|
icons/icon.png
|
||||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
1
cinnamon-dynamic-wallpaper@TobiZog/icon.png
Symbolic link
1
cinnamon-dynamic-wallpaper@TobiZog/icon.png
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
5.4/icons/icon.png
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"uuid": "cinnamon-dynamic-wallpaper@TobiZog",
|
"uuid": "cinnamon-dynamic-wallpaper@TobiZog",
|
||||||
"name": "Cinnamon Dynamic Wallpaper",
|
"name": "Cinnamon Dynamic Wallpaper",
|
||||||
"description": "Cinnamon extension for dynamic desktop backgrounds based on time and location",
|
"description": "Cinnamon extension for dynamic desktop backgrounds based on time and location",
|
||||||
"version": "1.1",
|
"version": "1.2",
|
||||||
"multiversion": true,
|
"multiversion": true,
|
||||||
"cinnamon-version": [
|
"cinnamon-version": [
|
||||||
"4.8",
|
"4.8",
|
||||||
|
|||||||
Reference in New Issue
Block a user