8 Commits
v.2.0 ... v.2.2

Author SHA1 Message Date
aae46e4b1e Readme 2024-02-04 16:11:31 +01:00
14497e21f2 Changelog, Readme, dynamic background example image 2024-02-04 16:08:05 +01:00
34e44f4b3c Observer pattern, Bugfixes 2024-02-04 14:45:12 +01:00
53f5984eb5 MVVM pattern finished, adding multiple location provider 2024-02-02 19:56:14 +01:00
8acc18c7fe Start migration to MVVM 2024-02-02 15:30:33 +01:00
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
119 changed files with 942 additions and 599 deletions

View File

@@ -1,4 +1,14 @@
# Version 2.0 (upcoming) # Version 2.2
- Bugfixes
- Migrate code to MVVM pattern
- Adding option to change the location provider
- Adding example image for dynamic background color
# Version 2.1
- Bugfixes
- Smaller UI for displays with reduced resolution (< 1000px height)
# Version 2.0
- New App icon - New App icon
- Preferences window redesign - All settings are now in one window accessable! - Preferences window redesign - All settings are now in one window accessable!
- Graphic visualizing of the time periods of a day with a bar chart - Graphic visualizing of the time periods of a day with a bar chart

View File

@@ -1,5 +1,5 @@
# Cinnamon Dynamic Wallpaper # 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"/> <img src="cinnamon-dynamic-wallpaper@TobiZog/5.4/res/icons/icon.svg" alt="drawing" width="200" style="margin-left:auto; margin-right:auto; width:50%; display:block"/>
![](res/wallpaper_merged.jpg) ![](res/wallpaper_merged.jpg)
@@ -11,11 +11,11 @@ This extension switches the background image of your Cinnamon desktop multiple t
- 10 day periods - 10 day periods
- HEIF converter - HEIF converter
- Image configuration assistent with simple one-click setup for image choices - Image configuration assistent with simple one-click setup for image choices
- Online location estimation or offline with manual latitude and longitude input - Online location estimation (three provider) or offline with manual latitude and longitude input
- Time periods individual configured by user - Time periods individual configured by user
- Offline sun angles estimation - Offline sun angles estimation
- Image stretching over multiple displays or repeat image for every display - Image stretching over multiple displays or repeat image for every display
- Show image on lock screen - Creating a color gradient based on the current wallpaper for images which not fill the whole screen
### Tested Cinnamon versions ### Tested Cinnamon versions
- 5.4 (Mint 21) - 5.4 (Mint 21)
@@ -23,11 +23,6 @@ This extension switches the background image of your Cinnamon desktop multiple t
- 5.8 (Mint 21.2) - 5.8 (Mint 21.2)
- 6.0 (Mint 21.3) - 6.0 (Mint 21.3)
#### Only supported with version 1.x
- 4.8 (Mint 20.1)
- 5.0 (Mint 20.2)
- 5.2 (Mint 20.3)
### Technology ### Technology
- `JavaScript` - `JavaScript`
- Display desktop notifications - Display desktop notifications
@@ -48,7 +43,7 @@ This extension switches the background image of your Cinnamon desktop multiple t
3. Search and download it 3. Search and download it
### From the repo ### From the repo
1. Download the Repository 1. Download the latest from the Releases page on GitHub: https://github.com/TobiZog/cinnamon-dynamic-wallpaper/releases
2. Extract the files 2. Extract the files
3. Copy the folder `cinnamon-dynamic-wallpaper@TobiZog` to `~/.local/share/cinnamon/extensions/` 3. Copy the folder `cinnamon-dynamic-wallpaper@TobiZog` to `~/.local/share/cinnamon/extensions/`
--- ---
@@ -71,12 +66,12 @@ The image sets are from https://github.com/adi1090x/dynamic-wallpaper
| Aurora | Beach | Bitday | | Aurora | Beach | Bitday |
| ------ | ----- | ------ | | ------ | ----- | ------ |
| ![](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) | | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/res/images/included_image_sets/aurora/5.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/res/images/included_image_sets/beach/4.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/res/images/included_image_sets/bitday/4.jpg) |
| Cliffs | Earth | Gradient | | Cliffs | Earth | Gradient |
| -------- | --------- | ------ | | -------- | --------- | ------ |
| ![](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) | | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/res/images/included_image_sets/cliffs/4.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/res/images/included_image_sets/earth/4.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/res/images/included_image_sets/gradient/4.jpg) |
| Lakeside | Mountains | Sahara | | 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) | | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/res/images/included_image_sets/lakeside/4.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/res/images/included_image_sets/mountains/4.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/res/images/included_image_sets/sahara/4.jpg) |

View File

@@ -33,9 +33,6 @@ const PATH = DIRECTORY.path;
// The extension object // The extension object
let extension; let extension;
// Time and date of the last location update
let lastLocationUpdate = -1
// Loop state // Loop state
let looping = true let looping = true
@@ -99,7 +96,7 @@ CinnamonDynamicWallpaperExtension.prototype = {
_loop: function () { _loop: function () {
if (looping) { if (looping) {
try { try {
Util.spawnCommandLine("/usr/bin/env python3 " + DIRECTORY.path + "/loop.py") Util.spawnCommandLine("/usr/bin/env python3 " + DIRECTORY.path + "/src/main.py loop")
} catch(e) { } catch(e) {
this.showNotification("Error!", this.showNotification("Error!",
"Cinnamon Dynamic Wallpaper got an error while running the loop script. Please create an issue on GitHub.") "Cinnamon Dynamic Wallpaper got an error while running the loop script. Please create an issue on GitHub.")
@@ -130,8 +127,7 @@ CinnamonDynamicWallpaperExtension.prototype = {
notification.addButton("open-settings", _("Open settings")); notification.addButton("open-settings", _("Open settings"));
notification.connect("action-invoked", () => notification.connect("action-invoked", () =>
Util.spawnCommandLine("/usr/bin/env python3 " + Util.spawnCommandLine("/usr/bin/env python3 " + DIRECTORY.path + "/src/main.py"));
DIRECTORY.path + "/preferences.py"));
} }
// Put all together // Put all together

View File

@@ -1 +1 @@
icons/icon.svg res/icons/icon.svg

View File

@@ -1,110 +0,0 @@
#!/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()

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

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