Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0d8fa6449c | |||
| 8aae370bf8 | |||
| 5447ecb930 | |||
| 605bc1e8ee | |||
| 5f52ae959a | |||
| 4798b9438d | |||
| 43fcd83b17 | |||
| 1ad5a9fe8b | |||
| b8996b1f03 | |||
| 34ad4a9589 |
1
.gitignore
vendored
@@ -4,3 +4,4 @@ extracted/
|
|||||||
custom_images/
|
custom_images/
|
||||||
*.txt
|
*.txt
|
||||||
selected/
|
selected/
|
||||||
|
__pycache__
|
||||||
10
CHANGELOG
@@ -1,3 +1,13 @@
|
|||||||
|
# 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
|
||||||
|
- Bugfix: No more restart needed after first enable
|
||||||
|
- Load at first start a predefined dynamic wallpaper
|
||||||
|
- More informations in the settings
|
||||||
|
|
||||||
# Version 1.1
|
# Version 1.1
|
||||||
- Compatibility with Cinnamon 5.4 and 5.8
|
- Compatibility with Cinnamon 5.4 and 5.8
|
||||||
- Two new image sets
|
- Two new image sets
|
||||||
|
|||||||
22
README.md
@@ -6,14 +6,18 @@
|
|||||||
Based on a location, this extension calculates the periods of a day and switches the background image of your Cinnamon desktop. The extension offers the choice between a set of included wallpapers or to select a HEIC-file.
|
Based on a location, this extension calculates the periods of a day and switches the background image of your Cinnamon desktop. The extension offers the choice between a set of included wallpapers or to select a HEIC-file.
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
- 6 included image sets
|
- 8 included image sets
|
||||||
- 9 day periods
|
- 9 day periods
|
||||||
- HEIF converter
|
- HEIF converter
|
||||||
- Image configuration assistent with simple one-click setup for image choose
|
- Image configuration assistent with simple one-click setup for image choose
|
||||||
- Online location estimation or offline with manual latitude and longitude input
|
- Online location estimation or offline with manual latitude and longitude input
|
||||||
- Offline sun angles estimation
|
- Offline sun angles estimation
|
||||||
|
- Image stretching over multiple displays or repeat image for every display
|
||||||
|
|
||||||
### 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)
|
||||||
@@ -27,11 +31,6 @@ Based on a location, this extension calculates the periods of a day and switches
|
|||||||
- Image Configurator UI was written with `Glade`
|
- Image Configurator UI was written with `Glade`
|
||||||
|
|
||||||
## Installation
|
## 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
|
### From Built-in Extension Manager
|
||||||

|

|
||||||
|
|
||||||
@@ -39,6 +38,11 @@ Based on a location, this extension calculates the periods of a day and switches
|
|||||||
2. Click on "Download"
|
2. Click on "Download"
|
||||||
3. Search and download it
|
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
|
## How to use it
|
||||||
1. Active the Extension via Cinnamon Extension Manager
|
1. Active the Extension via Cinnamon Extension Manager
|
||||||
2. Open the settings
|
2. Open the settings
|
||||||
@@ -56,12 +60,12 @@ The image sets are from https://github.com/adi1090x/dynamic-wallpaper
|
|||||||
|
|
||||||
| Aurora | Beach | Bitday |
|
| Aurora | Beach | Bitday |
|
||||||
| ------ | ----- | ------ |
|
| ------ | ----- | ------ |
|
||||||
|  |  |  |
|
|  |  |  |
|
||||||
|
|
||||||
| Cliffs | Gradient | Lakeside |
|
| Cliffs | Gradient | Lakeside |
|
||||||
| -------- | --------- | ------ |
|
| -------- | --------- | ------ |
|
||||||
|  |  |  |
|
|  |  |  |
|
||||||
|
|
||||||
| Mountains | Sahara |
|
| Mountains | Sahara |
|
||||||
| --------- | ------ |
|
| --------- | ------ |
|
||||||
|  |  |
|
|  |  |
|
||||||
1
cinnamon-dynamic-wallpaper@TobiZog/4.8/extension.js
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../5.4/extension.js
|
||||||
1
cinnamon-dynamic-wallpaper@TobiZog/4.8/icon
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../5.4/icon/
|
||||||
1
cinnamon-dynamic-wallpaper@TobiZog/4.8/icon.png
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../5.4/icons/icon.png
|
||||||
1
cinnamon-dynamic-wallpaper@TobiZog/4.8/icons
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../5.4/icons/
|
||||||
1
cinnamon-dynamic-wallpaper@TobiZog/4.8/image-configurator/data
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../5.4/image-configurator/data/
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../5.4/image-configurator/image-configurator.glade
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import os
|
||||||
|
import windowHandler
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
wh = windowHandler.WindowHandler(os.path.expanduser("~") + "/.cinnamon/configs/cinnamon-dynamic-wallpaper@TobiZog/cinnamon-dynamic-wallpaper@TobiZog.json")
|
||||||
|
wh.showMainWindow()
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../5.4/image-configurator/windowHandler.py
|
||||||
1
cinnamon-dynamic-wallpaper@TobiZog/4.8/images
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../5.4/images/
|
||||||
1
cinnamon-dynamic-wallpaper@TobiZog/4.8/scripts
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../5.4/scripts/
|
||||||
1
cinnamon-dynamic-wallpaper@TobiZog/4.8/settings-schema.json
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../5.4/settings-schema.json
|
||||||
@@ -58,27 +58,66 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
_init: function(uuid) {
|
_init: function(uuid) {
|
||||||
this.settings = new Settings.ExtensionSettings(this, uuid);
|
this.settings = new Settings.ExtensionSettings(this, uuid);
|
||||||
|
|
||||||
this.bindSettings("sw_auto_location", "autolocation", this.updateLocation)
|
// Image set
|
||||||
this.bindSettings("sc_location_refresh_time", "locationRefreshTime")
|
this.bindSettings("sw_image_stretch", "imageStretch", this.settingsUpdated)
|
||||||
this.bindSettings("etr_latitude", "latitude", this.updateLocation)
|
|
||||||
this.bindSettings("etr_longitude", "longitude", this.updateLocation)
|
// Location estimation
|
||||||
this.bindSettings("etr_img_morning_twilight", "img_morning_twilight", this.setImageToTime)
|
this.bindSettings("sw_auto_location", "autolocation", this.settingsUpdated)
|
||||||
this.bindSettings("etr_img_sunrise", "img_sunrise", this.setImageToTime)
|
this.bindSettings("sc_location_refresh_time", "locationRefreshTime", this.settingsUpdated)
|
||||||
this.bindSettings("etr_img_morning", "img_morning", this.setImageToTime)
|
this.bindSettings("etr_latitude", "latitude", this.settingsUpdated)
|
||||||
this.bindSettings("etr_img_noon", "img_noon", this.setImageToTime)
|
this.bindSettings("etr_longitude", "longitude", this.settingsUpdated)
|
||||||
this.bindSettings("etr_img_afternoon", "img_afternoon", this.setImageToTime)
|
|
||||||
this.bindSettings("etr_img_evening", "img_evening", this.setImageToTime)
|
// Time periods
|
||||||
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)
|
|
||||||
this.bindSettings("tv_times", "tvTimes")
|
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
|
||||||
|
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)
|
||||||
|
|
||||||
|
// Create the folder for the selected images
|
||||||
|
Util.spawnCommandLine("mkdir " + DIRECTORY.path + "/images/selected/")
|
||||||
|
|
||||||
|
// Link the default wallpaper to the folder
|
||||||
|
for (let i = 1; i <= 9; i++) {
|
||||||
|
Util.spawnCommandLine("ln -s " +
|
||||||
|
DIRECTORY.path + "/images/included_image_sets/lakeside/" + i + ".jpg " +
|
||||||
|
DIRECTORY.path + "/images/selected/" + i + ".jpg");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set image initial at desktop wallpaper
|
||||||
this.setImageToTime()
|
this.setImageToTime()
|
||||||
|
|
||||||
|
// Start the main loop, checks in fixed time periods the
|
||||||
this._loop()
|
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,
|
||||||
@@ -89,12 +128,24 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles changes in settings
|
||||||
|
*/
|
||||||
|
settingsUpdated: function() {
|
||||||
|
lastDayTime = suntimes.DAYPERIOD.NONE
|
||||||
|
|
||||||
|
this.updateLocation()
|
||||||
|
this.setImageToTime()
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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);
|
||||||
@@ -135,12 +186,23 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
changeWallpaper: function(imageURI) {
|
changeWallpaper: function(imageURI) {
|
||||||
let gSetting = new Gio.Settings({schema: 'org.cinnamon.desktop.background'});
|
let gSetting = new Gio.Settings({schema: 'org.cinnamon.desktop.background'});
|
||||||
gSetting.set_string('picture-uri', imageURI);
|
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();
|
Gio.Settings.sync();
|
||||||
gSetting.apply();
|
gSetting.apply();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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()
|
||||||
@@ -159,7 +221,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
|
||||||
@@ -184,7 +245,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()
|
||||||
@@ -195,39 +259,16 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
this.longitude = this.longitude
|
this.longitude = this.longitude
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh the image information, if it's necessary
|
|
||||||
this.setImageToTime()
|
|
||||||
|
|
||||||
// Update the update information
|
// Update the update information
|
||||||
lastLocationUpdate = new Date()
|
lastLocationUpdate = new Date()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/******************** UI Callbacks ********************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback for settings-schema
|
|
||||||
* Opens the external heic-importer window
|
|
||||||
*/
|
|
||||||
openImageConfigurator: function() {
|
|
||||||
Util.spawnCommandLine("/usr/bin/env python3 " + DIRECTORY.path + "/image-configurator/image-configurator.py");
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback for settings-schema
|
|
||||||
* Opens the browser and navigate to the URL of the respository
|
|
||||||
*/
|
|
||||||
openRepoWebsite: function() {
|
|
||||||
Util.spawnCommandLine("xdg-open https://github.com/TobiZog/cinnamon-dynamic-wallpaper");
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main loop
|
* Main loop
|
||||||
*/
|
*/
|
||||||
_loop: function() {
|
_loop: function () {
|
||||||
if(looping) {
|
if (looping) {
|
||||||
this.setImageToTime()
|
this.setImageToTime()
|
||||||
|
|
||||||
if (lastLocationUpdate < new Date().getTime() - this.locationRefreshTime * 1000) {
|
if (lastLocationUpdate < new Date().getTime() - this.locationRefreshTime * 1000) {
|
||||||
@@ -238,6 +279,45 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
|||||||
// Refresh every 60 seconds
|
// Refresh every 60 seconds
|
||||||
Mainloop.timeout_add_seconds(60, Lang.bind(this, this._loop));
|
Mainloop.timeout_add_seconds(60, Lang.bind(this, this._loop));
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/******************** UI Callbacks ********************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for settings-schema
|
||||||
|
* Opens the external image configurator window
|
||||||
|
*/
|
||||||
|
openImageConfigurator: function() {
|
||||||
|
Util.spawnCommandLine("/usr/bin/env python3 " +
|
||||||
|
DIRECTORY.path + "/image-configurator/image-configurator.py");
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for settings-schema
|
||||||
|
* Opens the browser and navigates to the URL of the respository
|
||||||
|
*/
|
||||||
|
openRepoWebsite: function() {
|
||||||
|
Util.spawnCommandLine("xdg-open https://github.com/TobiZog/cinnamon-dynamic-wallpaper");
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for settings-schema
|
||||||
|
* Opens the browser and navigates to the URL of the Cinnamon Spices extension
|
||||||
|
*/
|
||||||
|
openSpicesWebsite: function() {
|
||||||
|
Util.spawnCommandLine("xdg-open https://cinnamon-spices.linuxmint.com/extensions/view/97")
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for settings-schema
|
||||||
|
* Opens the browser and navigates to the GitHub issue page
|
||||||
|
*/
|
||||||
|
openIssueWebsite: function() {
|
||||||
|
Util.spawnCommandLine("xdg-open https://github.com/TobiZog/cinnamon-dynamic-wallpaper/issues/new")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,13 +346,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
cinnamon-dynamic-wallpaper@TobiZog/5.4/icon.png
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
icons/icon.png
|
||||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,6 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
class Source(Enum):
|
||||||
|
SELECTED = 0 # Load previous selected images
|
||||||
|
EXTRACT = 1 # Use a custom image set from a heic file
|
||||||
|
SET = 2 # Use an included image set
|
||||||
@@ -853,7 +853,7 @@
|
|||||||
<property name="window-position">center</property>
|
<property name="window-position">center</property>
|
||||||
<property name="default-width">1024</property>
|
<property name="default-width">1024</property>
|
||||||
<property name="default-height">768</property>
|
<property name="default-height">768</property>
|
||||||
<property name="icon">../icons/icon.png</property>
|
<property name="icon">../../icon.png</property>
|
||||||
<signal name="destroy" handler="onDestroy" swapped="no"/>
|
<signal name="destroy" handler="onDestroy" swapped="no"/>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkStack" id="stack_main">
|
<object class="GtkStack" id="stack_main">
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import os
|
||||||
|
import windowHandler
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
wh = windowHandler.WindowHandler(os.path.expanduser("~") + "/.config/cinnamon/spices/cinnamon-dynamic-wallpaper@TobiZog/cinnamon-dynamic-wallpaper@TobiZog.json")
|
||||||
|
wh.showMainWindow()
|
||||||
@@ -1,25 +1,25 @@
|
|||||||
import gi, os, glob, json, shutil, enum, threading, subprocess
|
import gi, os, glob, json, shutil, threading, subprocess
|
||||||
|
from data.enum import Source
|
||||||
|
|
||||||
gi.require_version("Gtk", "3.0")
|
gi.require_version("Gtk", "3.0")
|
||||||
from gi.repository import Gtk, GdkPixbuf
|
from gi.repository import Gtk, GdkPixbuf
|
||||||
|
|
||||||
PROJECT_DIR = os.path.dirname(os.path.dirname(__file__)) + "/"
|
CONFIGURATOR_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
UI_PATH = PROJECT_DIR + "image-configurator/" + "image-configurator.glade"
|
PROJECT_DIR = os.path.dirname(CONFIGURATOR_DIR) + "/"
|
||||||
|
UI_PATH = CONFIGURATOR_DIR + "/" + "image-configurator.glade"
|
||||||
|
|
||||||
IMAGE_DIR = PROJECT_DIR + "images/"
|
IMAGE_DIR = PROJECT_DIR + "images/"
|
||||||
IMAGE_EXTRACT_DIR = IMAGE_DIR + "extracted/"
|
IMAGE_EXTRACT_DIR = IMAGE_DIR + "extracted/"
|
||||||
IMAGE_SETS_DIR = IMAGE_DIR + "included_image_sets/"
|
IMAGE_SETS_DIR = IMAGE_DIR + "included_image_sets/"
|
||||||
IMAGE_SELECTED_DIR = IMAGE_DIR + "selected/"
|
IMAGE_SELECTED_DIR = IMAGE_DIR + "selected/"
|
||||||
|
|
||||||
class Source(enum.Enum):
|
|
||||||
SELECTED = 0 # Load previous selected images
|
|
||||||
EXTRACT = 1 # Use a custom image set from a heic file
|
|
||||||
SET = 2 # Use an included image set
|
|
||||||
|
|
||||||
|
class WindowHandler:
|
||||||
|
def __init__(self, pref_path: str) -> None:
|
||||||
|
|
||||||
class ImageConfigurator:
|
|
||||||
def __init__(self) -> None:
|
|
||||||
########### Class variables ###########
|
########### Class variables ###########
|
||||||
|
self.pref_path = pref_path
|
||||||
|
|
||||||
self.pref_vars = [
|
self.pref_vars = [
|
||||||
"etr_img_morning_twilight",
|
"etr_img_morning_twilight",
|
||||||
"etr_img_sunrise",
|
"etr_img_sunrise",
|
||||||
@@ -106,20 +106,6 @@ class ImageConfigurator:
|
|||||||
|
|
||||||
self.image_source = Source.SELECTED
|
self.image_source = Source.SELECTED
|
||||||
|
|
||||||
|
|
||||||
# Check for Cinnamon version
|
|
||||||
# With version 5.6+, the folder of the configuration file was changed
|
|
||||||
version = subprocess.check_output(["cinnamon", "--version"])
|
|
||||||
version = version.decode()
|
|
||||||
version = version[version.find(" "):version.rfind("\n")].strip()
|
|
||||||
|
|
||||||
if version.startswith("5.4"):
|
|
||||||
self.pref_path = os.path.expanduser("~") + \
|
|
||||||
"/.cinnamon/configs/cinnamon-dynamic-wallpaper@TobiZog/cinnamon-dynamic-wallpaper@TobiZog.json"
|
|
||||||
else:
|
|
||||||
self.pref_path = os.path.expanduser("~") + \
|
|
||||||
"/.config/cinnamon/spices/cinnamon-dynamic-wallpaper@TobiZog/cinnamon-dynamic-wallpaper@TobiZog.json"
|
|
||||||
|
|
||||||
# Load preferences
|
# Load preferences
|
||||||
self.loadFromSettings()
|
self.loadFromSettings()
|
||||||
|
|
||||||
@@ -139,6 +125,7 @@ class ImageConfigurator:
|
|||||||
def loadFromSettings(self):
|
def loadFromSettings(self):
|
||||||
""" Load preferences from the Cinnamon preference file
|
""" Load preferences from the Cinnamon preference file
|
||||||
"""
|
"""
|
||||||
|
#try:
|
||||||
# Load the settings
|
# Load the settings
|
||||||
with open(self.pref_path, "r") as pref_file:
|
with open(self.pref_path, "r") as pref_file:
|
||||||
pref_data = json.load(pref_file)
|
pref_data = json.load(pref_file)
|
||||||
@@ -173,6 +160,8 @@ class ImageConfigurator:
|
|||||||
self.cb_previews[i].set_active(j)
|
self.cb_previews[i].set_active(j)
|
||||||
else:
|
else:
|
||||||
self.image_source = Source.SET
|
self.image_source = Source.SET
|
||||||
|
#except:
|
||||||
|
# pass
|
||||||
|
|
||||||
|
|
||||||
def writeToSettings(self):
|
def writeToSettings(self):
|
||||||
@@ -376,8 +365,3 @@ class ImageConfigurator:
|
|||||||
""" UI signal if the window is closed by the user
|
""" UI signal if the window is closed by the user
|
||||||
"""
|
"""
|
||||||
Gtk.main_quit()
|
Gtk.main_quit()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
ic = ImageConfigurator()
|
|
||||||
ic.showMainWindow()
|
|
||||||
|
Before Width: | Height: | Size: 454 KiB After Width: | Height: | Size: 454 KiB |
|
Before Width: | Height: | Size: 488 KiB After Width: | Height: | Size: 488 KiB |
|
Before Width: | Height: | Size: 436 KiB After Width: | Height: | Size: 436 KiB |
|
Before Width: | Height: | Size: 436 KiB After Width: | Height: | Size: 436 KiB |
|
Before Width: | Height: | Size: 470 KiB After Width: | Height: | Size: 470 KiB |
|
Before Width: | Height: | Size: 435 KiB After Width: | Height: | Size: 435 KiB |
|
Before Width: | Height: | Size: 426 KiB After Width: | Height: | Size: 426 KiB |
|
Before Width: | Height: | Size: 420 KiB After Width: | Height: | Size: 420 KiB |
|
Before Width: | Height: | Size: 485 KiB After Width: | Height: | Size: 485 KiB |
|
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 513 KiB After Width: | Height: | Size: 513 KiB |
|
Before Width: | Height: | Size: 1012 KiB After Width: | Height: | Size: 1012 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 695 KiB After Width: | Height: | Size: 695 KiB |
|
Before Width: | Height: | Size: 710 KiB After Width: | Height: | Size: 710 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 352 KiB After Width: | Height: | Size: 352 KiB |
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 238 KiB After Width: | Height: | Size: 238 KiB |
|
Before Width: | Height: | Size: 241 KiB After Width: | Height: | Size: 241 KiB |
|
Before Width: | Height: | Size: 293 KiB After Width: | Height: | Size: 293 KiB |
|
Before Width: | Height: | Size: 183 KiB After Width: | Height: | Size: 183 KiB |
|
Before Width: | Height: | Size: 211 KiB After Width: | Height: | Size: 211 KiB |
|
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 210 KiB |
|
Before Width: | Height: | Size: 249 KiB After Width: | Height: | Size: 249 KiB |
|
Before Width: | Height: | Size: 182 KiB After Width: | Height: | Size: 182 KiB |
|
Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 163 KiB |
|
Before Width: | Height: | Size: 449 KiB After Width: | Height: | Size: 449 KiB |
|
Before Width: | Height: | Size: 558 KiB After Width: | Height: | Size: 558 KiB |
|
Before Width: | Height: | Size: 681 KiB After Width: | Height: | Size: 681 KiB |
|
Before Width: | Height: | Size: 654 KiB After Width: | Height: | Size: 654 KiB |
|
Before Width: | Height: | Size: 631 KiB After Width: | Height: | Size: 631 KiB |
|
Before Width: | Height: | Size: 548 KiB After Width: | Height: | Size: 548 KiB |
|
Before Width: | Height: | Size: 540 KiB After Width: | Height: | Size: 540 KiB |
|
Before Width: | Height: | Size: 465 KiB After Width: | Height: | Size: 465 KiB |
|
Before Width: | Height: | Size: 392 KiB After Width: | Height: | Size: 392 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 119 KiB |
|
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 119 KiB |
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 135 KiB |
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 99 KiB |
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
@@ -19,15 +19,19 @@
|
|||||||
"title": "About",
|
"title": "About",
|
||||||
"sections": [
|
"sections": [
|
||||||
"sec_project",
|
"sec_project",
|
||||||
"sec_github"
|
"sec_github",
|
||||||
|
"sec_report_issue"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
"sec_image_configuration": {
|
"sec_image_configuration": {
|
||||||
"type": "section",
|
"type": "section",
|
||||||
"title": "Image set",
|
"title": "Image set",
|
||||||
"keys": [
|
"keys": [
|
||||||
"lb_image_configuration",
|
"lb_image_configuration",
|
||||||
"btn_config_images"
|
"btn_config_images",
|
||||||
|
"sw_image_stretch"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"sec_location": {
|
"sec_location": {
|
||||||
@@ -52,7 +56,9 @@
|
|||||||
"title": "About the project",
|
"title": "About the project",
|
||||||
"keys": [
|
"keys": [
|
||||||
"lb_about",
|
"lb_about",
|
||||||
"lb_author"
|
"lb_author",
|
||||||
|
"lb_spices",
|
||||||
|
"btn_spices"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"sec_github": {
|
"sec_github": {
|
||||||
@@ -62,8 +68,18 @@
|
|||||||
"lb_repository",
|
"lb_repository",
|
||||||
"btn_open_repository"
|
"btn_open_repository"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"sec_report_issue": {
|
||||||
|
"type": "section",
|
||||||
|
"title": "Report an issue",
|
||||||
|
"keys": [
|
||||||
|
"lb_report_issue",
|
||||||
|
"btn_report_issue"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
"lb_image_configuration": {
|
"lb_image_configuration": {
|
||||||
"type": "label",
|
"type": "label",
|
||||||
"description": "Choose an included image set or import a heic-file with the Image Configurator"
|
"description": "Choose an included image set or import a heic-file with the Image Configurator"
|
||||||
@@ -73,6 +89,11 @@
|
|||||||
"description": "Image Configurator",
|
"description": "Image Configurator",
|
||||||
"callback": "openImageConfigurator"
|
"callback": "openImageConfigurator"
|
||||||
},
|
},
|
||||||
|
"sw_image_stretch": {
|
||||||
|
"type": "switch",
|
||||||
|
"description": "Expand image over all displays",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
"sw_auto_location": {
|
"sw_auto_location": {
|
||||||
"type": "switch",
|
"type": "switch",
|
||||||
"default": true,
|
"default": true,
|
||||||
@@ -104,6 +125,8 @@
|
|||||||
"description": "Time sections today",
|
"description": "Time sections today",
|
||||||
"default": ""
|
"default": ""
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
"lb_about": {
|
"lb_about": {
|
||||||
"type": "label",
|
"type": "label",
|
||||||
"description": "Based on a location, this extension calculates the periods of a day and switch the background image of your Cinnamon desktop. The extension offers the choice between a set of predownloaded wallpapers or to select a custom set of images."
|
"description": "Based on a location, this extension calculates the periods of a day and switch the background image of your Cinnamon desktop. The extension offers the choice between a set of predownloaded wallpapers or to select a custom set of images."
|
||||||
@@ -112,6 +135,16 @@
|
|||||||
"type": "label",
|
"type": "label",
|
||||||
"description": "Developed by TobiZog"
|
"description": "Developed by TobiZog"
|
||||||
},
|
},
|
||||||
|
"lb_spices": {
|
||||||
|
"type": "label",
|
||||||
|
"description": "If you want more information or rate the extension, you can visit the site Cinnamon Spices Website."
|
||||||
|
},
|
||||||
|
"btn_spices": {
|
||||||
|
"type": "button",
|
||||||
|
"description": "Cinnamon Dynamic Wallpaper at Cinnamon Spices Website",
|
||||||
|
"callback": "openSpicesWebsite"
|
||||||
|
},
|
||||||
|
|
||||||
"lb_repository": {
|
"lb_repository": {
|
||||||
"type": "label",
|
"type": "label",
|
||||||
"description": "This project is Open Source. You can visit the whole source code of this extension on GitHub"
|
"description": "This project is Open Source. You can visit the whole source code of this extension on GitHub"
|
||||||
@@ -121,54 +154,71 @@
|
|||||||
"description": "Open the Repository",
|
"description": "Open the Repository",
|
||||||
"callback": "openRepoWebsite"
|
"callback": "openRepoWebsite"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"lb_report_issue": {
|
||||||
|
"type": "label",
|
||||||
|
"description": "Do you find an issue? Or want a new feature? Go to the GitHub repository and create a new issue."
|
||||||
|
},
|
||||||
|
|
||||||
|
"btn_report_issue": {
|
||||||
|
"type": "button",
|
||||||
|
"description": "Submit an Issue",
|
||||||
|
"callback": "openIssueWebsite"
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
"etr_choosen_image_set": {
|
"etr_choosen_image_set": {
|
||||||
"type": "entry",
|
"type": "entry",
|
||||||
"default": "",
|
"default": "lakeside",
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"etr_img_morning_twilight": {
|
"etr_img_morning_twilight": {
|
||||||
"type": "entry",
|
"type": "entry",
|
||||||
"default": "",
|
"default": "1.jpg",
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"etr_img_sunrise": {
|
"etr_img_sunrise": {
|
||||||
"type": "entry",
|
"type": "entry",
|
||||||
"default": "",
|
"default": "2.jpg",
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"etr_img_morning": {
|
"etr_img_morning": {
|
||||||
"type": "entry",
|
"type": "entry",
|
||||||
"default": "",
|
"default": "3.jpg",
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"etr_img_noon": {
|
"etr_img_noon": {
|
||||||
"type": "entry",
|
"type": "entry",
|
||||||
"default": "",
|
"default": "4.jpg",
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"etr_img_afternoon": {
|
"etr_img_afternoon": {
|
||||||
"type": "entry",
|
"type": "entry",
|
||||||
"default": "",
|
"default": "5.jpg",
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"etr_img_evening": {
|
"etr_img_evening": {
|
||||||
"type": "entry",
|
"type": "entry",
|
||||||
"default": "",
|
"default": "6.jpg",
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"etr_img_sunset": {
|
"etr_img_sunset": {
|
||||||
"type": "entry",
|
"type": "entry",
|
||||||
"default": "",
|
"default": "7.jpg",
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"etr_img_night_twilight": {
|
"etr_img_night_twilight": {
|
||||||
"type": "entry",
|
"type": "entry",
|
||||||
"default": "",
|
"default": "8.jpg",
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"etr_img_night": {
|
"etr_img_night": {
|
||||||
"type": "entry",
|
"type": "entry",
|
||||||
"default": "",
|
"default": "9.jpg",
|
||||||
"description": ""
|
"description": ""
|
||||||
|
},
|
||||||
|
"first_start": {
|
||||||
|
"type": "generic",
|
||||||
|
"default": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1 +1 @@
|
|||||||
icons/icon.png
|
5.4/icons/icon.png
|
||||||
@@ -2,8 +2,12 @@
|
|||||||
"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.3",
|
||||||
|
"multiversion": true,
|
||||||
"cinnamon-version": [
|
"cinnamon-version": [
|
||||||
|
"4.8",
|
||||||
|
"5.0",
|
||||||
|
"5.2",
|
||||||
"5.4",
|
"5.4",
|
||||||
"5.6",
|
"5.6",
|
||||||
"5.8"
|
"5.8"
|
||||||
|
|||||||