47 Commits
v.1.1 ... v.2.1

Author SHA1 Message Date
fe1cea9e2b Metadata/Readme for release of 2.1 2024-01-26 18:56:12 +01:00
0bf78c54d0 Bugfix 2024-01-26 18:52:51 +01:00
8a58e66c20 Bugfixes, Smaller UI for displays with reduced resolution 2024-01-23 18:11:13 +01:00
f9a84b18e8 Bugfix, Readme 2024-01-18 20:03:43 +01:00
c53c149d31 New image set (earth), refresh all image sets 2024-01-17 22:23:12 +01:00
17348f7acf Documentation, cleanup 2024-01-17 20:53:18 +01:00
e1b464e36c HEIC import 2024-01-17 20:04:12 +01:00
d97ec091c5 Bugfixes, exchange file chooser button 2024-01-17 19:09:37 +01:00
af63b5ad43 Bugfixes, Readme 2024-01-16 18:14:13 +01:00
3636e3ffac Remove HEIC option for beta release 2024-01-16 17:01:36 +01:00
c04ec20704 Adding OK button, bugfixes 2024-01-16 11:46:36 +01:00
506bb45dda Bugfix 2024-01-14 20:22:44 +01:00
4a4cc9f778 Rewrite preference system 2024-01-14 19:26:33 +01:00
20223b21de Calculating dynamic background gradient, option to stretch image 2024-01-14 15:32:45 +01:00
66e4023b7a HEIC import, reimplement image change system 2024-01-04 19:13:53 +01:00
22920ad712 Load images from source folder to preview 2024-01-04 15:42:11 +01:00
513cb38154 Load preview images on ComboBox changes 2024-01-03 22:47:53 +01:00
14f6548ce7 Documentation 2024-01-03 21:28:24 +01:00
12cd81bf65 Connect image set selection in preferences 2024-01-03 21:13:28 +01:00
1833399aaa Rewrite suntimes.py 2024-01-02 22:11:51 +01:00
4e1da62b90 Adding custom times configuration with live bar chart (#5) 2023-12-26 23:13:43 +01:00
a0fe24bbd1 Improve cinnamon preferences storage & load system 2023-12-26 16:39:31 +01:00
ccaf08e238 Get and display location to the preference UI 2023-12-26 15:29:27 +01:00
1a8a986674 Converting Python scripts to classes 2023-12-25 20:22:31 +01:00
7c5e86e8dc Bind settings window to Cinnamon Spiced pref button 2023-12-23 14:02:31 +01:00
132b33bdf8 New icon, README + CHANGELOG enhanced 2023-12-23 01:42:43 +01:00
0cfe14feed Documentation, change two colors of bar graph 2023-12-22 23:51:09 +01:00
f843e01847 New time period calculation system, bind it also to the UI 2023-12-22 23:20:39 +01:00
d21557b0f1 Read/Write system for Cinnamon preference file 2023-12-21 12:17:12 +01:00
6a997e4945 Preferences UI 2023-12-21 10:31:53 +01:00
d88a21c6f0 New source selection buttons 2023-12-16 05:00:11 +01:00
edc1e62ff3 Migrate time circle to time bar 2023-12-10 00:11:28 +01:00
f087c18ab1 Start preferences redesign 2023-10-12 00:23:56 +02:00
a5b9da3f34 Cleanup 2023-08-25 20:41:47 +02:00
d433ab579d Display period times in Image Configurator, Changelog 2023-08-25 19:55:39 +02:00
78a925ff8a Bugfixes 2023-08-25 19:26:10 +02:00
5ca5b76d7c Log file system implemented 2023-08-25 17:41:42 +02:00
0d8fa6449c Version Update 2023-07-24 23:36:25 +02:00
8aae370bf8 Adding option to stretch the image over multiple displays 2023-07-24 23:22:16 +02:00
5447ecb930 Readme, changelog 2023-07-13 20:02:52 +02:00
605bc1e8ee More informations in the settings 2023-07-13 19:53:15 +02:00
5f52ae959a Readme, bugfix, documentation 2023-07-13 18:46:40 +02:00
4798b9438d Notification, load at first start a wallpaper, bugfix restart on after first enable 2023-07-13 14:32:13 +02:00
43fcd83b17 Revert "Notification, load at first start a wallpaper, bugfix restart on after first enable"
This reverts commit 1ad5a9fe8b.
2023-07-13 14:31:43 +02:00
1ad5a9fe8b Notification, load at first start a wallpaper, bugfix restart on after first enable 2023-07-13 14:30:47 +02:00
b8996b1f03 Compatibility with Cinnamon 4.8 and higher 2023-07-13 13:40:55 +02:00
34ad4a9589 Working on support for Cinnamon 4.8 and newer 2023-07-13 12:41:31 +02:00
159 changed files with 8104 additions and 1974 deletions

9
.gitignore vendored
View File

@@ -1,6 +1,9 @@
*.glade~
*.glade#
extracted/
custom_images/
*.txt
selected/
*.json
extracted_images/
selected/
__pycache__
time_bar.svg
time_bar_polylines.svg

View File

@@ -1,3 +1,34 @@
# Version 2.1
- Bugfixes
- Smaller UI for displays with reduced resolution (< 1000px height)
# Version 2.0
- New App icon
- Preferences window redesign - All settings are now in one window accessable!
- Graphic visualizing of the time periods of a day with a bar chart
- Adding custom time periods by user choice
- Adding folder as image source
- Option to display image on lock screens
- Bugfixes
- Remove support for Cinnamon 5.2 and older
- Apply and OK button to test settings without closing the window
# Version 1.4
- Log System
- Bugfixes
- Display times in Image Configurator
- Display time of last location update in Preferences
# 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
- Compatibility with Cinnamon 5.4 and 5.8
- Two new image sets

View File

@@ -1,37 +1,40 @@
# Cinnamon Dynamic Wallpaper
<img src="cinnamon-dynamic-wallpaper@TobiZog/5.4/icons/icon.svg" alt="drawing" width="200" style="margin-left:auto; margin-right:auto; width:50%; display:block"/>
![](res/wallpaper_merged.jpg)
## About the project
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.
This extension switches the background image of your Cinnamon desktop multiple times in a day, based on a location or custom time periods. You can choose between included image-sets, your own HEIC-file or a source folder with single images. Configuration through a user-friendly configuration window.
### Features
- 6 included image sets
- 9 day periods
- 9 included image sets
- 10 day periods
- HEIF converter
- Image configuration assistent with simple one-click setup for image choose
- Image configuration assistent with simple one-click setup for image choices
- Online location estimation or offline with manual latitude and longitude input
- Time periods individual configured by user
- Offline sun angles estimation
- Image stretching over multiple displays or repeat image for every display
- Show image on lock screen
### Tested Cinnamon versions
- 5.4 (Mint 21)
- 5.6 (Mint 21.1)
- 5.8 (Mint 21.2)
- 6.0 (Mint 21.3)
### Technology
- Using `JavaScript` for
- Sun angle estimation
- Location estimation
- Change of the desktop wallpapers
- `Python` displays the Image Configurator
- Image Configurator UI was written with `Glade`
- `JavaScript`
- Display desktop notifications
- Calling the Python loop script every 60 seconds to refresh the background image
- `Python`
- Handles the preference window
- Esimates the location
- Changes of the desktop wallpapers
- `Glade`
- Preference window UI design
---
## 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)
@@ -39,29 +42,36 @@ Based on a location, this extension calculates the periods of a day and switches
2. Click on "Download"
3. Search and download it
## How to use 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/`
---
## Usage
1. Active the Extension via Cinnamon Extension Manager
2. Open the settings
3. Keep `Estimate coordinates via network` active or disable it and insert latitude and longitude in the fields
4. Choose a set of images or disable it and select for every daytime an image manually
## Image Configurator
The Cinnamon Dynamic Wallpaper extension offers an integrated image configuration assistant. Here, you can choose an included image set or import a HEIC-file from your system. You have to choose the images for the time periods after the import.
3. Configure it to your
- You can apply the setted settings without closing the window if you click on "Apply"
4. If your config is complete, click on "OK"
---
## Preferences Window
Because of the lack of configuration options in the standard Cinnamon configuration system for extensions offers this extension a custom preference window.
All configuration will be handled there. You can choose between included image sets, a HEIC file or a folder source and set the image to ten different daytime periods. Time periods will be estimated via network, custom coordinations or custom time periods. Some behaviour preferences (strech image, fill empty background with gradient color) are also here.
![](res/image_configurator.png)
---
## Included image sets
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 |
| Cliffs | Earth | Gradient |
| -------- | --------- | ------ |
| ![](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/earth/4.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/images/included_image_sets/gradient/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) |
| Lakeside | Mountains | Sahara |
| --------- | ------ | ------ |
| ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/images/included_image_sets/lakeside/4.jpg) | ![](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) |

View File

@@ -0,0 +1,4 @@
class ImageSourceEnum(enumerate):
IMAGESET = "image_set"
HEICFILE = "heic_file"
SOURCEFOLDER = "source_folder"

View File

@@ -0,0 +1,4 @@
class PeriodSourceEnum(enumerate):
NETWORKLOCATION = "network_location"
CUSTOMLOCATION = "custom_location"
CUSTOMTIMEPERIODS = "custom_time_periods"

View File

@@ -0,0 +1,176 @@
/**
* @name Cinnamon-Dynamic-Wallpaper
* @alias TobiZog
* @since 2023-05-17
*
* @description Main application file
*/
/******************** Imports ********************/
const Util = imports.misc.util;
const Settings = imports.ui.settings;
const Mainloop = imports.mainloop;
const Lang = imports.lang;
const { find_program_in_path } = imports.gi.GLib;
const Gio = imports.gi.Gio;
const MessageTray = imports.ui.messageTray;
const St = imports.gi.St;
const Main = imports.ui.main;
/******************** Constants ********************/
const UUID = "cinnamon-dynamic-wallpaper@TobiZog";
const APPNAME = "Cinnamon Dynamic Wallpaper"
const DIRECTORY = imports.ui.extensionSystem.extensionMeta[UUID];
const PATH = DIRECTORY.path;
/******************** Global Variables ********************/
// The extension object
let extension;
// Loop state
let looping = true
/******************** Objects ********************/
function CinnamonDynamicWallpaperExtension(uuid) {
this._init(uuid);
}
CinnamonDynamicWallpaperExtension.prototype = {
/******************** Lifecycle ********************/
/**
* Initialization
*
* @param {string} uuid Universally Unique Identifier
*/
_init: function(uuid) {
this.settings = new Settings.ExtensionSettings(this, uuid);
// 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)
this.settings.setValue("source_folder", DIRECTORY["path"] + "/images/included_image_sets/lakeside/")
}
// Start the main loop, checks in fixed time periods the
this._loop()
},
/**
* Binding the settings objects
*
* @param {string} ui_name Name of preference in settings-schema.json
* @param {string} js_name Name of preference in JavaScript
* @param {Function} func Function to call on change
*/
bindSettings: function (ui_name, js_name, func = this.on_settings_changed) {
this.settings.bindProperty(
Settings.BindingDirection.IN,
ui_name,
js_name,
func
)
},
/**
* Main loop
*/
_loop: function () {
if (looping) {
try {
Util.spawnCommandLine("/usr/bin/env python3 " + DIRECTORY.path + "/loop.py")
} catch(e) {
this.showNotification("Error!",
"Cinnamon Dynamic Wallpaper got an error while running the loop script. Please create an issue on GitHub.")
}
// Refresh every 60 seconds
Mainloop.timeout_add_seconds(60, Lang.bind(this, this._loop));
}
},
showNotification(title, text, showOpenSettings = false) {
let source = new MessageTray.Source(this.uuid);
// Parameter
let params = {
icon: new St.Icon({
icon_name: "icon",
icon_type: St.IconType.FULLCOLOR,
icon_size: source.ICON_SIZE
})
};
// The notification itself
let notification = new MessageTray.Notification(source, title, text, params);
// Display the "Open settings" button, if showOpenSettings
if (showOpenSettings) {
notification.addButton("open-settings", _("Open settings"));
notification.connect("action-invoked", () =>
Util.spawnCommandLine("/usr/bin/env python3 " +
DIRECTORY.path + "/preferences.py"));
}
// Put all together
Main.messageTray.add(source);
// Display it
source.notify(notification);
}
}
/******************** Lifecycle ********************/
/**
* Lifecycle function on initialization
*
* @param {*} extensionMeta Metadata of the extension
*/
function init(extensionMeta) {
extension = new CinnamonDynamicWallpaperExtension(extensionMeta.uuid);
}
/**
* Lifecycle function on enable
*
* @returns The extension object
*/
function enable() {
// Check for necessary software
if (!find_program_in_path('heif-convert')) {
Util.spawnCommandLine("apturl apt://libheif-examples");
}
return extension;
}
/**
* Lifecycle function on disable
*/
function disable() {
looping = false
}

View File

@@ -0,0 +1 @@
icons/icon.svg

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<linearGradient id="a" gradientTransform="matrix(0.232143 0 0 0.328947 -9.109985 263.79837)" gradientUnits="userSpaceOnUse" x1="88.595886" x2="536.595886" y1="-449.394012" y2="-449.394012">
<stop offset="0" stop-color="#77767b"/>
<stop offset="0.0384615" stop-color="#c0bfbc"/>
<stop offset="0.0768555" stop-color="#9a9996"/>
<stop offset="0.923077" stop-color="#9a9996"/>
<stop offset="0.961538" stop-color="#c0bfbc"/>
<stop offset="1" stop-color="#77767b"/>
</linearGradient>
<linearGradient id="b" gradientTransform="matrix(0.978582 0 0 0.937323 -9.031522 -9.577706)" gradientUnits="userSpaceOnUse" x1="20.937046" x2="127.213333" y1="76.334984" y2="76.334984">
<stop offset="0" stop-color="#066996"/>
<stop offset="1" stop-color="#001533"/>
</linearGradient>
<path d="m 19.457031 15.972656 h 88 c 4.417969 0 8 3.582032 8 8 v 84 c 0 4.417969 -3.582031 8 -8 8 h -88 c -4.417969 0 -8 -3.582031 -8 -8 v -84 c 0 -4.417968 3.582031 -8 8 -8 z m 0 0" fill="url(#a)"/>
<path d="m 17.328125 11.972656 h 92.257813 c 3.242187 0 5.871093 2.519532 5.871093 5.625 v 88.75 c 0 3.105469 -2.628906 5.625 -5.871093 5.625 h -92.257813 c -3.242187 0 -5.871094 -2.519531 -5.871094 -5.625 v -88.75 c 0 -3.105468 2.628907 -5.625 5.871094 -5.625 z m 0 0" fill="url(#b)"/>
<path d="m 63.945312 74.6875 c 0 10.257812 -8.671874 18.574219 -19.367187 18.574219 s -19.367187 -8.316407 -19.367187 -18.574219 s 8.671874 -18.574219 19.367187 -18.574219 s 19.367187 8.316407 19.367187 18.574219 z m 0 0" fill="#f7c22c"/>
<path d="m 61.160156 74.136719 c 0 10.03125 -8.128906 18.164062 -18.160156 18.164062 c -10.027344 0 -18.160156 -8.132812 -18.160156 -18.164062 c 0 -10.027344 8.132812 -18.160157 18.160156 -18.160157 c 10.03125 0 18.160156 8.132813 18.160156 18.160157 z m 0 0" fill="#f7d97e"/>
<path d="m 85.46875 19.277344 c 7.65625 3.941406 12.472656 11.832031 12.472656 20.445312 c 0 12.695313 -10.292968 22.992188 -22.992187 22.992188 c -0.074219 -0.007813 -0.148438 -0.011719 -0.222657 -0.019532 c 3.253907 1.679688 6.863282 2.558594 10.527344 2.5625 c 12.695313 0 22.992188 -10.296874 22.992188 -22.992187 c -0.003906 -12.613281 -10.167969 -22.871094 -22.777344 -22.988281 z m 0 0" fill="#eaa22f"/>
<path d="m 82.804688 18.175781 c 7.660156 3.9375 12.472656 11.828125 12.476562 20.441407 c 0 12.699218 -10.296875 22.992187 -22.992188 22.992187 c -0.078124 -0.003906 -0.152343 -0.011719 -0.226562 -0.015625 c 3.253906 1.679688 6.863281 2.554688 10.527344 2.558594 c 12.699218 0 22.992187 -10.292969 22.992187 -22.992188 c -0.003906 -12.613281 -10.164062 -22.867187 -22.777343 -22.984375 z m 0 0" fill="#ffc61b"/>
<g fill="#f7d97e">
<path d="m 44.394531 45.09375 c 0.527344 0 0.953125 0.445312 0.953125 1 v 7.558594 c 0 0.554687 -0.425781 1 -0.953125 1 c -0.527343 0 -0.957031 -0.445313 -0.957031 -1 v -7.558594 c 0 -0.554688 0.429688 -1 0.957031 -1 z m 0 0"/>
<path d="m 44.222656 94.574219 c 0.527344 0 0.953125 0.449219 0.953125 1 v 7.5625 c 0 0.554687 -0.425781 1 -0.953125 1 s -0.957031 -0.445313 -0.957031 -1 v -7.5625 c 0 -0.550781 0.429687 -1 0.957031 -1 z m 0 0"/>
<path d="m 65.402344 74.839844 c 0 -0.527344 0.449218 -0.953125 1 -0.953125 h 7.5625 c 0.550781 0 1 0.425781 1 0.953125 s -0.449219 0.957031 -1 0.957031 h -7.5625 c -0.550782 0 -1 -0.429687 -1 -0.957031 z m 0 0"/>
<path d="m 13.84375 74.300781 c 0 -0.527343 0.445312 -0.957031 1 -0.957031 h 7.558594 c 0.554687 0 1 0.429688 1 0.957031 c 0 0.527344 -0.445313 0.953125 -1 0.953125 h -7.558594 c -0.554688 0 -1 -0.425781 -1 -0.953125 z m 0 0"/>
<path d="m 22.230469 53.699219 c 0.371093 -0.375 0.988281 -0.359375 1.378906 0.03125 l 5.347656 5.347656 c 0.390625 0.390625 0.40625 1.007813 0.03125 1.382813 c -0.371093 0.371093 -0.992187 0.355468 -1.382812 -0.035157 l -5.34375 -5.34375 c -0.390625 -0.390625 -0.40625 -1.011719 -0.03125 -1.382812 z m 0 0"/>
<path d="m 59.175781 88.910156 c 0.371094 -0.375 0.992188 -0.359375 1.382813 0.03125 l 5.347656 5.347656 c 0.390625 0.390626 0.402344 1.007813 0.03125 1.382813 c -0.375 0.371094 -0.992188 0.355469 -1.382812 -0.035156 l -5.347657 -5.34375 c -0.390625 -0.390625 -0.40625 -1.011719 -0.03125 -1.382813 z m 0 0"/>
<path d="m 59.378906 60.664062 c -0.371094 -0.371093 -0.359375 -0.992187 0.03125 -1.382812 l 5.347656 -5.34375 c 0.390626 -0.390625 1.007813 -0.40625 1.382813 -0.035156 c 0.371094 0.375 0.359375 0.992187 -0.03125 1.382812 l -5.347656 5.347656 c -0.390625 0.390626 -1.007813 0.40625 -1.382813 0.03125 z m 0 0"/>
<path d="m 22.867188 95.21875 c -0.375 -0.375 -0.359376 -0.992188 0.03125 -1.382812 l 5.34375 -5.347657 c 0.390624 -0.390625 1.011718 -0.40625 1.382812 -0.03125 c 0.375 0.371094 0.359375 0.992188 -0.03125 1.382813 l -5.347656 5.347656 c -0.390625 0.390625 -1.007813 0.402344 -1.378906 0.03125 z m 0 0"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 856 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

View File

@@ -0,0 +1,110 @@
#!/usr/bin/python3
from scripts.cinnamon_pref_handler import *
from scripts.suntimes import *
from datetime import datetime, time
from enums.PeriodSourceEnum import *
from scripts.location import *
from gi.repository import Gio
from PIL import Image
class Loop():
def __init__(self) -> None:
self.prefs = Cinnamon_Pref_Handler()
self.suntimes = Suntimes()
self.location = Location()
self.background_settings = Gio.Settings.new("org.cinnamon.desktop.background")
# Position should estimate by network
if self.prefs.period_source == PeriodSourceEnum.NETWORKLOCATION:
current_location = self.location.get_location()
self.suntimes.calc_suntimes(float(current_location["latitude"]), float(current_location["longitude"]))
self.start_times = self.suntimes.day_periods
# Position is given by user
elif self.prefs.period_source == PeriodSourceEnum.CUSTOMLOCATION:
self.suntimes.calc_suntimes(float(self.prefs.latitude_custom), float(self.prefs.longitude_custom))
self.start_times = self.suntimes.day_periods
# No position, concrete times
else:
def string_to_time_converter(raw_str: str) -> time:
hour = raw_str[0:raw_str.find(":")]
minute = raw_str[raw_str.find(":") + 1:]
return time(hour=int(hour), minute=int(minute))
self.start_times = [
string_to_time_converter(self.prefs.period_custom_start_time[0]),
string_to_time_converter(self.prefs.period_custom_start_time[1]),
string_to_time_converter(self.prefs.period_custom_start_time[2]),
string_to_time_converter(self.prefs.period_custom_start_time[3]),
string_to_time_converter(self.prefs.period_custom_start_time[4]),
string_to_time_converter(self.prefs.period_custom_start_time[5]),
string_to_time_converter(self.prefs.period_custom_start_time[6]),
string_to_time_converter(self.prefs.period_custom_start_time[7]),
string_to_time_converter(self.prefs.period_custom_start_time[8]),
string_to_time_converter(self.prefs.period_custom_start_time[9])
]
def exchange_image(self):
""" Replace the desktop image
"""
# Get the time of day
time_now = time(datetime.now().hour, datetime.now().minute)
# Assign the last image as fallback
self.current_image_uri = self.prefs.source_folder + self.prefs.period_images[9]
for i in range(0, 9):
# Replace the image URI, if it's not the last time period of the day
if self.start_times[i] <= time_now and time_now < self.start_times[i + 1]:
self.current_image_uri = self.prefs.source_folder + self.prefs.period_images[i]
break
# Set the background
self.background_settings['picture-uri'] = "file://" + self.current_image_uri
# Set background stretching
self.background_settings['picture-options'] = self.prefs.picture_aspect
self.set_background_gradient()
def set_background_gradient(self):
""" Setting a gradient background to hide images, which are not high enough
"""
# Load the image
try:
im = Image.open(self.current_image_uri)
pix = im.load()
# Width and height of the current setted image
width, height = im.size
# Color of the top and bottom pixel in the middle of the image
top_color = pix[width / 2,0]
bottom_color = pix[width / 2, height - 1]
# Create the gradient
self.background_settings['color-shading-type'] = "vertical"
if self.prefs.dynamic_background_color:
self.background_settings['primary-color'] = f"#{top_color[0]:x}{top_color[1]:x}{top_color[2]:x}"
self.background_settings['secondary-color'] = f"#{bottom_color[0]:x}{bottom_color[1]:x}{bottom_color[2]:x}"
else:
self.background_settings['primary-color'] = "#000000"
self.background_settings['secondary-color'] = "#000000"
except:
self.background_settings['primary-color'] = "#000000"
self.background_settings['secondary-color'] = "#000000"
# Needed for JavaScript
if __name__ == "__main__":
l = Loop()
l.exchange_image()

Some files were not shown because too many files have changed in this diff Show More