25 Commits

Author SHA1 Message Date
05cce6540f Changelog 2024-08-08 20:09:03 +02:00
193501a9e7 Readme, PO 2024-08-08 19:44:42 +02:00
900b1f197e Three new image sets 2024-08-08 19:30:43 +02:00
fb91bd3b30 Switch from libheif to imagemagick, fix #23 2024-08-08 18:41:08 +02:00
8b9a708cb4 Bugfix if wallpaper time change between 23:00 and midnight 2024-07-07 19:35:20 +02:00
6afc62a87f Readme with Troubleshooting section, updated translations from linuxmint/cinnamon-spices-extensions 2024-07-07 17:35:43 +02:00
d4cc8f2616 Backing up and restore the slick-greeter file 2024-02-15 20:27:23 +01:00
333bb3b995 Hungarian translation, move current login image to usr/share/pixmaps 2024-02-15 19:58:53 +01:00
77db85cc71 Bugfix for locations near the dateline 2024-02-15 18:31:32 +01:00
1c6060d8d5 Small fixes, changlelog 2024-02-15 17:34:07 +01:00
TobiZog
8da056350a Merge pull request #16 from blogdron/main
Add Russian translation
2024-02-15 17:24:25 +01:00
0ab3297054 Adding support for Login screen wallpaper 2024-02-15 17:04:20 +01:00
blogdron
6ac34770ff Add Russian translation 2024-02-15 16:46:46 +03:00
45e95d0e2b Readme 2024-02-15 13:20:59 +01:00
d2d954b25f Small fix 2024-02-12 12:17:33 +01:00
72144f76c6 Bugfixes, translation 2024-02-12 12:15:45 +01:00
755664230a Adding dutch, german and spanish (rcalixte) translation 2024-02-11 19:34:58 +01:00
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
160 changed files with 4500 additions and 671 deletions

1
.gitignore vendored
View File

@@ -2,6 +2,7 @@
*.glade#
*.txt
*.json
*.tar.gz
extracted_images/
selected/
__pycache__

View File

@@ -1,4 +1,29 @@
# Version 2.0 (upcoming)
# Version 2.5
- Switch from libheif to imagemagick, HEIC conversion is now possible on Arch and Fedora!
- Three new image sets: desert, island, lake
# Version 2.4
- Adding Login window support
- Adding Russian translation (Thanks to blogdron)
- Adding Hungarian translation (Thanks to vajdao)
- Bugfix: Time period calculation on locations near the dateline, like Japan
# Version 2.3
- Adding Dutch translation
- Adding German translation
- Adding Spanish translation (Thanks to haggen88)
# 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
- Preferences window redesign - All settings are now in one window accessable!
- Graphic visualizing of the time periods of a day with a bar chart

View File

@@ -1,5 +1,5 @@
# 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)
@@ -7,26 +7,22 @@
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
- 9 included image sets
- 12 included image sets
- 10 day periods
- HEIF converter
- 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
- Offline sun angles estimation
- 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
- 5.4 (Mint 21)
- 5.6 (Mint 21.1)
- 5.8 (Mint 21.2)
- 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)
- 6.2 (Mint 22)
### Technology
- `JavaScript`
@@ -48,7 +44,7 @@ This extension switches the background image of your Cinnamon desktop multiple t
3. Search and download it
### 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
3. Copy the folder `cinnamon-dynamic-wallpaper@TobiZog` to `~/.local/share/cinnamon/extensions/`
---
@@ -65,18 +61,61 @@ All configuration will be handled there. You can choose between included image s
![](res/image_configurator.png)
---
## Troubleshooting
### General
At first: Check if the extension is installed AND activated (check symbol on the left in Extension window).
![](res/activated-extension.png)
Many errors on Linux Mint/Cinnamon Desktop will be printed to Melange. You can open it by pressing `Super Key` + `L`.
### The Preference Window doesn't open!
Go to your home directory, open the terminal. Execute the command:
```
python3 .local/share/cinnamon/extensions/cinnamon-dynamic-wallpaper@TobiZog/5.4/src/main.py
```
This will manually start the window. If there are any problems, the terminal will show it. Use these informations to fix the problem or add them to the Issue.
### The extension don't change the wallpaper
Go to your home directory, open the terminal. Execute the command:
```
python3 .local/share/cinnamon/extensions/cinnamon-dynamic-wallpaper@TobiZog/5.4/src/main.py loop
```
It executes the loop-function which handles the wallpaper change. Terminal will show errors. Use these informations to fix the problem or add them to the Issue.
---
## Contribute
### Translation
You want to contribute a language which isn't supported yet? Here is how to do:
1. Fork the cinnamon-spices-extensions project: https://github.com/linuxmint/cinnamon-spices-extensions
2. Pull the repository
3. Open `cinnamon-dynamic-wallpaper@TobiZog/files/cinnamon-dynamic-wallpaper@TobiZog/po/cinnamon-dynamic-wallpaper@TobiZog.pot` with a po-tool like poedit (https://poedit.net/).
4. Create a new translation in your language
5. Push the changes to your repository
6. Create a pull request
---
## Included image sets
The image sets are from https://github.com/adi1090x/dynamic-wallpaper
| 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 |
| -------- | --------- | ------ |
| ![](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) |
| Cliffs | Desert | Earth |
| -------- | --------- | --------- |
| ![](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/desert/4.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/res/images/included_image_sets/earth/4.jpg) |
| Gradient | Island | Lake |
| --- | --- | --- |
![](cinnamon-dynamic-wallpaper@TobiZog/5.4/res/images/included_image_sets/gradient/4.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/res/images/included_image_sets/island/4.jpg) | ![](cinnamon-dynamic-wallpaper@TobiZog/5.4/res/images/included_image_sets/lake/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) |
| ![](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

@@ -1,7 +1,7 @@
/**
* @name Cinnamon-Dynamic-Wallpaper
* @alias TobiZog
* @since 2023-05-17
* @name Cinnamon-Dynamic-Wallpaper
* @alias TobiZog
* @since 2023-05-17
*
* @description Main application file
*/
@@ -17,7 +17,8 @@ const Gio = imports.gi.Gio;
const MessageTray = imports.ui.messageTray;
const St = imports.gi.St;
const Main = imports.ui.main;
const Gettext = imports.gettext;
const GLib = imports.gi.GLib;
/******************** Constants ********************/
@@ -33,9 +34,6 @@ const PATH = DIRECTORY.path;
// The extension object
let extension;
// Time and date of the last location update
let lastLocationUpdate = -1
// Loop state
let looping = true
@@ -47,6 +45,15 @@ function CinnamonDynamicWallpaperExtension(uuid) {
}
function _(str) {
let customTranslation = Gettext.dgettext(UUID, str);
if (customTranslation !== str) {
return customTranslation;
}
return Gettext.gettext(str);
}
CinnamonDynamicWallpaperExtension.prototype = {
/******************** Lifecycle ********************/
@@ -59,19 +66,33 @@ CinnamonDynamicWallpaperExtension.prototype = {
_init: function(uuid) {
this.settings = new Settings.ExtensionSettings(this, uuid);
Gettext.bindtextdomain(UUID, GLib.get_home_dir() + '/.local/share/locale');
// 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)
this.showNotification(_("Welcome to Cinnamon Dynamic Wallpaper"),
_("Check the preferences to choose a dynamic wallpaper"), true)
// Check for necessary software
if (!find_program_in_path('convert')) {
// Run on Ubuntu/Debian based distros with APT package manager
if(GLib.find_program_in_path("apturl")) {
Util.spawnCommandLine("apturl apt://imagemagick");
} else {
// Notification on other distros
this.showNotification(_("imagemagick is not installed"),
_("Please install the package manually for the full range of functions"), 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/")
this.settings.setValue("source_folder", DIRECTORY["path"] + "/res/images/included_image_sets/lakeside/")
}
// Start the main loop, checks in fixed time periods the
// Start the main loop, checks in fixed time periods
this._loop()
},
@@ -99,10 +120,10 @@ CinnamonDynamicWallpaperExtension.prototype = {
_loop: function () {
if (looping) {
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) {
this.showNotification("Error!",
"Cinnamon Dynamic Wallpaper got an error while running the loop script. Please create an issue on GitHub.")
this.showNotification(_("Error!"),
_("Cinnamon Dynamic Wallpaper got an error while running the loop script. Please create an issue on GitHub."))
}
// Refresh every 60 seconds
@@ -130,8 +151,7 @@ CinnamonDynamicWallpaperExtension.prototype = {
notification.addButton("open-settings", _("Open settings"));
notification.connect("action-invoked", () =>
Util.spawnCommandLine("/usr/bin/env python3 " +
DIRECTORY.path + "/preferences.py"));
Util.spawnCommandLine("/usr/bin/env python3 " + DIRECTORY.path + "/src/main.py"));
}
// Put all together
@@ -162,11 +182,6 @@ function init(extensionMeta) {
* @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;
}

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: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

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: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

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