Working on support for Cinnamon 4.8 and newer

This commit is contained in:
2023-07-13 12:41:31 +02:00
parent 5628dfc4b0
commit 34ad4a9589
93 changed files with 25 additions and 16 deletions

3
.gitignore vendored
View File

@@ -3,4 +3,5 @@
extracted/
custom_images/
*.txt
selected/
selected/
__pycache__

View File

@@ -0,0 +1 @@
../5.4/extension.js

View File

@@ -0,0 +1 @@
../5.4/icon.png

View File

@@ -0,0 +1 @@
../5.4/icons/

View File

@@ -0,0 +1 @@
pref_path = "/.cinnamon/configs/cinnamon-dynamic-wallpaper@TobiZog/cinnamon-dynamic-wallpaper@TobiZog.json"

View File

@@ -0,0 +1 @@
../../5.4/image-configurator/image-configurator.glade

View File

@@ -0,0 +1 @@
../../5.4/image-configurator/image-configurator.py

View File

@@ -0,0 +1 @@
../5.4/images/

View File

@@ -0,0 +1 @@
../5.4/scripts/

View File

@@ -0,0 +1 @@
../5.4/settings-schema.json

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -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

View File

@@ -0,0 +1 @@
pref_path = "/.config/cinnamon/spices/cinnamon-dynamic-wallpaper@TobiZog/cinnamon-dynamic-wallpaper@TobiZog.json"

View File

@@ -1,21 +1,19 @@
import gi, os, glob, json, shutil, enum, threading, subprocess
from data.routes import pref_path
from data.enum import Source
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GdkPixbuf
PROJECT_DIR = os.path.dirname(os.path.dirname(__file__)) + "/"
UI_PATH = PROJECT_DIR + "image-configurator/" + "image-configurator.glade"
PREF_PATH = os.path.expanduser("~") + pref_path
IMAGE_DIR = PROJECT_DIR + "images/"
IMAGE_EXTRACT_DIR = IMAGE_DIR + "extracted/"
IMAGE_SETS_DIR = IMAGE_DIR + "included_image_sets/"
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 ImageConfigurator:
def __init__(self) -> None:
@@ -113,13 +111,6 @@ class ImageConfigurator:
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
self.loadFromSettings()
@@ -140,7 +131,7 @@ class ImageConfigurator:
""" Load preferences from the Cinnamon preference file
"""
# Load the settings
with open(self.pref_path, "r") as pref_file:
with open(PREF_PATH, "r") as pref_file:
pref_data = json.load(pref_file)
@@ -179,7 +170,7 @@ class ImageConfigurator:
""" Save preferences to the Cinnamon preference file
"""
# Load the settings
with open(self.pref_path, "r") as pref_file:
with open(PREF_PATH, "r") as pref_file:
pref_data = json.load(pref_file)
@@ -197,7 +188,7 @@ class ImageConfigurator:
# Write the settings
with open(self.pref_path, "w") as pref_file:
with open(PREF_PATH, "w") as pref_file:
json.dump(pref_data, pref_file, separators=(',', ':'), indent=4)

View File

@@ -3,6 +3,7 @@
"name": "Cinnamon Dynamic Wallpaper",
"description": "Cinnamon extension for dynamic desktop backgrounds based on time and location",
"version": "1.1",
"multiversion": true,
"cinnamon-version": [
"5.4",
"5.6",