diff --git a/README.md b/README.md
index dfd576a..fa05028 100644
--- a/README.md
+++ b/README.md
@@ -15,12 +15,15 @@ Based on a location, this extension calculates the periods of a day and switches
- Image stretching over multiple displays or repeat image for every display
### Tested Cinnamon versions
-- 4.8 (Mint 20.1)
-- 5.0 (Mint 20.2)
-- 5.2 (Mint 20.3)
- 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)
### Technology
- Using `JavaScript` for
diff --git a/cinnamon-dynamic-wallpaper@TobiZog/4.8/extension.js b/cinnamon-dynamic-wallpaper@TobiZog/4.8/extension.js
deleted file mode 120000
index aebfac8..0000000
--- a/cinnamon-dynamic-wallpaper@TobiZog/4.8/extension.js
+++ /dev/null
@@ -1 +0,0 @@
-../5.4/extension.js
\ No newline at end of file
diff --git a/cinnamon-dynamic-wallpaper@TobiZog/4.8/icon.png b/cinnamon-dynamic-wallpaper@TobiZog/4.8/icon.png
deleted file mode 120000
index 1da76b6..0000000
--- a/cinnamon-dynamic-wallpaper@TobiZog/4.8/icon.png
+++ /dev/null
@@ -1 +0,0 @@
-../5.4/icons/icon.png
\ No newline at end of file
diff --git a/cinnamon-dynamic-wallpaper@TobiZog/4.8/icons b/cinnamon-dynamic-wallpaper@TobiZog/4.8/icons
deleted file mode 120000
index bc358a2..0000000
--- a/cinnamon-dynamic-wallpaper@TobiZog/4.8/icons
+++ /dev/null
@@ -1 +0,0 @@
-../5.4/icons/
\ No newline at end of file
diff --git a/cinnamon-dynamic-wallpaper@TobiZog/4.8/image-configurator/data b/cinnamon-dynamic-wallpaper@TobiZog/4.8/image-configurator/data
deleted file mode 120000
index bed5c10..0000000
--- a/cinnamon-dynamic-wallpaper@TobiZog/4.8/image-configurator/data
+++ /dev/null
@@ -1 +0,0 @@
-../../5.4/image-configurator/data/
\ No newline at end of file
diff --git a/cinnamon-dynamic-wallpaper@TobiZog/4.8/image-configurator/image-configurator.glade b/cinnamon-dynamic-wallpaper@TobiZog/4.8/image-configurator/image-configurator.glade
deleted file mode 120000
index 4cf1b56..0000000
--- a/cinnamon-dynamic-wallpaper@TobiZog/4.8/image-configurator/image-configurator.glade
+++ /dev/null
@@ -1 +0,0 @@
-../../5.4/image-configurator/image-configurator.glade
\ No newline at end of file
diff --git a/cinnamon-dynamic-wallpaper@TobiZog/4.8/image-configurator/image-configurator.py b/cinnamon-dynamic-wallpaper@TobiZog/4.8/image-configurator/image-configurator.py
deleted file mode 100644
index d444587..0000000
--- a/cinnamon-dynamic-wallpaper@TobiZog/4.8/image-configurator/image-configurator.py
+++ /dev/null
@@ -1,6 +0,0 @@
-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()
diff --git a/cinnamon-dynamic-wallpaper@TobiZog/4.8/image-configurator/windowHandler.py b/cinnamon-dynamic-wallpaper@TobiZog/4.8/image-configurator/windowHandler.py
deleted file mode 120000
index 16cad97..0000000
--- a/cinnamon-dynamic-wallpaper@TobiZog/4.8/image-configurator/windowHandler.py
+++ /dev/null
@@ -1 +0,0 @@
-../../5.4/image-configurator/windowHandler.py
\ No newline at end of file
diff --git a/cinnamon-dynamic-wallpaper@TobiZog/4.8/images b/cinnamon-dynamic-wallpaper@TobiZog/4.8/images
deleted file mode 120000
index a01f271..0000000
--- a/cinnamon-dynamic-wallpaper@TobiZog/4.8/images
+++ /dev/null
@@ -1 +0,0 @@
-../5.4/images/
\ No newline at end of file
diff --git a/cinnamon-dynamic-wallpaper@TobiZog/4.8/scripts b/cinnamon-dynamic-wallpaper@TobiZog/4.8/scripts
deleted file mode 120000
index 887daeb..0000000
--- a/cinnamon-dynamic-wallpaper@TobiZog/4.8/scripts
+++ /dev/null
@@ -1 +0,0 @@
-../5.4/scripts/
\ No newline at end of file
diff --git a/cinnamon-dynamic-wallpaper@TobiZog/4.8/settings-schema.json b/cinnamon-dynamic-wallpaper@TobiZog/4.8/settings-schema.json
deleted file mode 120000
index e877003..0000000
--- a/cinnamon-dynamic-wallpaper@TobiZog/4.8/settings-schema.json
+++ /dev/null
@@ -1 +0,0 @@
-../5.4/settings-schema.json
\ No newline at end of file
diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/cinnamon_pref_handler.py b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/cinnamon_pref_handler.py
new file mode 100644
index 0000000..4fef680
--- /dev/null
+++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/cinnamon_pref_handler.py
@@ -0,0 +1,56 @@
+import os, json
+from enums.PreferenceEnums import PrefenceEnums
+
+# Location of the Cinnamon preference file since Cinnamon 5.4
+pref_location = os.path.expanduser("~") + \
+ "/.config/cinnamon/spices/cinnamon-dynamic-wallpaper@TobiZog/cinnamon-dynamic-wallpaper@TobiZog.json"
+
+
+def write_to_preferences(parameter: PrefenceEnums, value: str):
+ """ Write a preference value to the JSON file
+
+ Args:
+ parameter (PrefenceEnums): Name of the parameter
+ value (str): Value to write
+ """
+ with open(pref_location, "r") as pref_file:
+ pref_data = json.load(pref_file)
+
+ if parameter in pref_data:
+ pref_data[parameter]["value"] = value
+ else:
+ pref_data[parameter] = {
+ "type": "entry",
+ "default": "",
+ "description": "",
+ "value": value
+ }
+
+ with open(pref_location, "w") as pref_file:
+ json.dump(pref_data, pref_file, separators=(',', ':'), indent=4)
+
+
+def read_str_from_preferences(parameter: PrefenceEnums) -> str:
+ """ Read a value from the JSON file
+
+ Args:
+ parameter (PrefenceEnums): Name of the parameter to get
+
+ Returns:
+ str: Value of the parameter
+ """
+ with open(pref_location, "r") as pref_file:
+ pref_data = json.load(pref_file)
+
+ if parameter in pref_data:
+ return pref_data[parameter]["value"]
+ else:
+ return ""
+
+def read_int_from_preferences(parameter: PrefenceEnums) -> int:
+ value = read_str_from_preferences(parameter)
+
+ if value == "":
+ return 0
+ else:
+ return int(value)
\ No newline at end of file
diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/enums/ImageSourceEnum.py b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/enums/ImageSourceEnum.py
new file mode 100644
index 0000000..5e63031
--- /dev/null
+++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/enums/ImageSourceEnum.py
@@ -0,0 +1,4 @@
+class ImageSourceEnum(enumerate):
+ IMAGESET = "image_set"
+ HEICFILE = "heic_file"
+ SOURCEFOLDER = "source_folder"
\ No newline at end of file
diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/enums/PeriodSourceEnum.py b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/enums/PeriodSourceEnum.py
new file mode 100644
index 0000000..5c53281
--- /dev/null
+++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/enums/PeriodSourceEnum.py
@@ -0,0 +1,4 @@
+class PeriodSourceEnum(enumerate):
+ NETWORKLOCATION = "network_location"
+ CUSTOMLOCATION = "custom_location"
+ CUSTOMTIMEPERIODS = "custom_time_periods"
\ No newline at end of file
diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/enums/PreferenceEnums.py b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/enums/PreferenceEnums.py
new file mode 100644
index 0000000..508e126
--- /dev/null
+++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/enums/PreferenceEnums.py
@@ -0,0 +1,41 @@
+class PrefenceEnums(enumerate):
+ EXPANDOVERALLDISPLAY = "expand_over_all_displays"
+ SHOWONLOCKSCREEN = "show_on_lock_screen"
+
+ # Which type of image source will be used
+ # image_set, heic_file, source_folder
+ IMAGESOURCE = "image_source"
+
+ SELECTEDIMAGESET = "selected_image_set"
+ SELECTEDSOURCEFOLDER = "selected_source_folder"
+
+ PERIOD1IMAGE = "period_1_image"
+ PERIOD2IMAGE = "period_2_image"
+ PERIOD3IMAGE = "period_3_image"
+ PERIOD4IMAGE = "period_4_image"
+ PERIOD5IMAGE = "period_5_image"
+ PERIOD6IMAGE = "period_6_image"
+ PERIOD7IMAGE = "period_7_image"
+ PERIOD8IMAGE = "period_8_image"
+ PERIOD9IMAGE = "period_9_image"
+ PERIOD10IMAGE = "period_10_image"
+
+
+ # How the period will estimage
+ # network_location, custom_location, custom_time_periods
+ PERIODSOURCE = "period_source"
+
+ LOCATIONREFRESHINTERVALS = "location_refresh_intervals"
+ LATITUDE = "latitude"
+ LONGITUDE = "longitude"
+
+ PERIOD1STARTTIME = "period_1_start_time"
+ PERIOD2STARTTIME = "period_2_start_time"
+ PERIOD3STARTTIME = "period_3_start_time"
+ PERIOD4STARTTIME = "period_4_start_time"
+ PERIOD5STARTTIME = "period_5_start_time"
+ PERIOD6STARTTIME = "period_6_start_time"
+ PERIOD7STARTTIME = "period_7_start_time"
+ PERIOD8STARTTIME = "period_8_start_time"
+ PERIOD9STARTTIME = "period_9_start_time"
+ PERIOD10STARTTIME = "period_10_start_time"
diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/preferences.glade b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/preferences.glade
index f6185d5..97793e7 100644
--- a/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/preferences.glade
+++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/preferences.glade
@@ -839,7 +839,7 @@
-
-
+
True
True
end
@@ -1156,7 +1156,7 @@
-
+
True
True
adjustment1
@@ -1198,7 +1198,7 @@
-
+
True
True
@@ -1239,7 +1239,7 @@
-
+
True
True
@@ -2530,6 +2530,7 @@
False
True
True
+
diff --git a/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/preferences.py b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/preferences.py
index dbaf6f3..59b2e00 100644
--- a/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/preferences.py
+++ b/cinnamon-dynamic-wallpaper@TobiZog/5.4/preferences/preferences.py
@@ -3,6 +3,10 @@
# Imports
import gi, os, subprocess
from time_bar import create_bar_chart
+from cinnamon_pref_handler import *
+from enums.PreferenceEnums import PrefenceEnums
+from enums.ImageSourceEnum import ImageSourceEnum
+from enums.PeriodSourceEnum import PeriodSourceEnum
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GdkPixbuf
@@ -34,15 +38,20 @@ class Preferences:
self.lbrHeicFile = self.builder.get_object("lbr_heic_file")
self.lbrSourceFolder = self.builder.get_object("lbr_source_folder")
self.imgBar = self.builder.get_object("img_bar")
+ self.swExpandOverAllDisplays = self.builder.get_object("sw_expand_over_all_displays")
+ self.swShowOnLockScreen = self.builder.get_object("sw_show_on_lock_screen")
## Location & Times
self.tbNetworkLocation = self.builder.get_object("tb_network_location")
self.tbCustomLocation = self.builder.get_object("tb_custom_location")
self.tbTimePeriods = self.builder.get_object("tb_time_periods")
self.lbrNetworkLocation = self.builder.get_object("lbr_network_location")
+ self.spbNetworkLocationRefreshTime = self.builder.get_object("spb_network_location_refresh_time")
self.lbrCustomLocationLongitude = self.builder.get_object("lbr_custom_location_longitude")
self.lbrCustomLocationLatitude = self.builder.get_object("lbr_custom_location_latitude")
self.lbrTimePeriods = self.builder.get_object("lbr_time_periods")
+ self.etrLongitude = self.builder.get_object("etr_longitude")
+ self.etrLatitude = self.builder.get_object("etr_latitude")
# Time bar
@@ -58,12 +67,61 @@ class Preferences:
window = self.builder.get_object("window_main")
window.show_all()
- self.tbImageSet.set_active(True)
- self.tbNetworkLocation.set_active(True)
+
+ # Load from preferences
+ if read_str_from_preferences(PrefenceEnums.IMAGESOURCE) == ImageSourceEnum.IMAGESET:
+ self.tbImageSet.set_active(True)
+ elif read_str_from_preferences(PrefenceEnums.IMAGESOURCE) == ImageSourceEnum.HEICFILE:
+ self.tbHeicFile.set_active(True)
+ elif read_str_from_preferences(PrefenceEnums.IMAGESOURCE) == ImageSourceEnum.SOURCEFOLDER:
+ self.tbSourceFolder.set_active(True)
+
+ self.swExpandOverAllDisplays.set_active(read_str_from_preferences(PrefenceEnums.EXPANDOVERALLDISPLAY))
+ self.swShowOnLockScreen.set_active(read_str_from_preferences(PrefenceEnums.SHOWONLOCKSCREEN))
+
+
+ if read_str_from_preferences(PrefenceEnums.PERIODSOURCE) == PeriodSourceEnum.NETWORKLOCATION:
+ self.tbNetworkLocation.set_active(True)
+ elif read_str_from_preferences(PrefenceEnums.PERIODSOURCE) == PeriodSourceEnum.CUSTOMLOCATION:
+ self.tbCustomLocation.set_active(True)
+ elif read_str_from_preferences(PrefenceEnums.PERIODSOURCE) == PeriodSourceEnum.CUSTOMTIMEPERIODS:
+ self.tbTimePeriods.set_active(True)
+
+ self.spbNetworkLocationRefreshTime.set_value(read_int_from_preferences(PrefenceEnums.LOCATIONREFRESHINTERVALS))
+ self.etrLatitude.set_text(read_str_from_preferences(PrefenceEnums.LATITUDE))
+ self.etrLongitude.set_text(read_str_from_preferences(PrefenceEnums.LONGITUDE))
Gtk.main()
+ def onApply(self, *args):
+ # todo: Store all values to settings
+ if self.tbImageSet.get_active():
+ write_to_preferences(PrefenceEnums.IMAGESOURCE, ImageSourceEnum.IMAGESET)
+ elif self.tbHeicFile.get_active():
+ write_to_preferences(PrefenceEnums.IMAGESOURCE, ImageSourceEnum.HEICFILE)
+ elif self.tbSourceFolder.get_active():
+ write_to_preferences(PrefenceEnums.IMAGESOURCE, ImageSourceEnum.SOURCEFOLDER)
+
+ write_to_preferences(PrefenceEnums.EXPANDOVERALLDISPLAY, self.swExpandOverAllDisplays.get_active())
+ write_to_preferences(PrefenceEnums.SHOWONLOCKSCREEN, self.swShowOnLockScreen.get_active())
+
+
+ write_to_preferences(PrefenceEnums.LOCATIONREFRESHINTERVALS, self.spbNetworkLocationRefreshTime.get_value())
+ write_to_preferences(PrefenceEnums.LATITUDE, self.etrLatitude.get_text())
+ write_to_preferences(PrefenceEnums.LONGITUDE, self.etrLongitude.get_text())
+
+ if self.tbNetworkLocation.get_active():
+ write_to_preferences(PrefenceEnums.PERIODSOURCE, PeriodSourceEnum.NETWORKLOCATION)
+ elif self.tbCustomLocation.get_active():
+ write_to_preferences(PrefenceEnums.PERIODSOURCE, PeriodSourceEnum.CUSTOMLOCATION)
+ elif self.tbTimePeriods.get_active():
+ write_to_preferences(PrefenceEnums.PERIODSOURCE, PeriodSourceEnum.CUSTOMTIMEPERIODS)
+
+
+ self.onDestroy()
+
+
def onDestroy(self, *args):
""" Lifecycle handler when window will be destroyed
"""
@@ -134,6 +192,9 @@ class Preferences:
self.lbrCustomLocationLatitude.set_visible(False)
self.lbrTimePeriods.set_visible(True)
+
+ # About
+
def onCinnamonSpicesWebsiteButtonClicked(self, button):
subprocess.Popen(["xdg-open", "https://cinnamon-spices.linuxmint.com/extensions/view/97"])