Working on support for Cinnamon 4.8 and newer
285
cinnamon-dynamic-wallpaper@TobiZog/5.4/extension.js
Normal file
@@ -0,0 +1,285 @@
|
||||
/**
|
||||
* @name Cinnamon-Dynamic-Wallpaper
|
||||
* @alias TobiZog
|
||||
* @since 2023
|
||||
*/
|
||||
|
||||
/******************** Imports ********************/
|
||||
|
||||
const MessageTray = imports.ui.messageTray;
|
||||
const St = imports.gi.St;
|
||||
const Main = imports.ui.main;
|
||||
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;
|
||||
|
||||
let suntimes = require('./scripts/suntimes')
|
||||
let location = require('./scripts/location')
|
||||
|
||||
|
||||
/******************** 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;
|
||||
|
||||
// Time and date of the last location update
|
||||
let lastLocationUpdate = new Date()
|
||||
|
||||
// The last calculated suntime of the day
|
||||
let lastDayTime = suntimes.DAYPERIOD.NONE
|
||||
|
||||
let looping = true
|
||||
|
||||
|
||||
/******************** Objects ********************/
|
||||
|
||||
function CinnamonDynamicWallpaperExtension(uuid) {
|
||||
this._init(uuid);
|
||||
}
|
||||
|
||||
|
||||
CinnamonDynamicWallpaperExtension.prototype = {
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @param {string} uuid Universally Unique Identifier
|
||||
*/
|
||||
_init: function(uuid) {
|
||||
this.settings = new Settings.ExtensionSettings(this, uuid);
|
||||
|
||||
this.bindSettings("sw_auto_location", "autolocation", this.updateLocation)
|
||||
this.bindSettings("sc_location_refresh_time", "locationRefreshTime")
|
||||
this.bindSettings("etr_latitude", "latitude", this.updateLocation)
|
||||
this.bindSettings("etr_longitude", "longitude", this.updateLocation)
|
||||
this.bindSettings("etr_img_morning_twilight", "img_morning_twilight", this.setImageToTime)
|
||||
this.bindSettings("etr_img_sunrise", "img_sunrise", this.setImageToTime)
|
||||
this.bindSettings("etr_img_morning", "img_morning", this.setImageToTime)
|
||||
this.bindSettings("etr_img_noon", "img_noon", this.setImageToTime)
|
||||
this.bindSettings("etr_img_afternoon", "img_afternoon", this.setImageToTime)
|
||||
this.bindSettings("etr_img_evening", "img_evening", this.setImageToTime)
|
||||
this.bindSettings("etr_img_sunset", "img_sunset", this.setImageToTime)
|
||||
this.bindSettings("etr_img_night_twilight", "img_night_twilight", this.setImageToTime)
|
||||
this.bindSettings("etr_img_night", "img_night", this.setImageToTime)
|
||||
this.bindSettings("tv_times", "tvTimes")
|
||||
|
||||
this.setImageToTime()
|
||||
|
||||
this._loop()
|
||||
},
|
||||
|
||||
|
||||
bindSettings: function (ui_name, js_name, func = this.on_settings_changed) {
|
||||
this.settings.bindProperty(
|
||||
Settings.BindingDirection.IN,
|
||||
ui_name,
|
||||
js_name,
|
||||
func
|
||||
)
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Displaying a desktop notification
|
||||
*
|
||||
* @param {string} title The Title in the notification
|
||||
* @param {string} text The text in the notification
|
||||
* @param {boolean} showOpenSettings Display the "Open settings" button in the notification, defaults to false
|
||||
*/
|
||||
showNotification: function (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("xlet-settings extension " + UUID));
|
||||
}
|
||||
|
||||
// Put all together
|
||||
Main.messageTray.add(source);
|
||||
|
||||
// Display it
|
||||
source.notify(notification);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Changes the desktop background image
|
||||
*
|
||||
* @param {jpg} imageURI The new desktop image
|
||||
*/
|
||||
changeWallpaper: function(imageURI) {
|
||||
let gSetting = new Gio.Settings({schema: 'org.cinnamon.desktop.background'});
|
||||
gSetting.set_string('picture-uri', imageURI);
|
||||
Gio.Settings.sync();
|
||||
gSetting.apply();
|
||||
},
|
||||
|
||||
|
||||
|
||||
setImageToTime: function() {
|
||||
let times = suntimes.calcTimePeriod(this.latitude, this.longitude)
|
||||
let now = new Date()
|
||||
|
||||
let timesArray = [
|
||||
times["morning_twilight"], times["sunrise"], times["morning"],
|
||||
times["noon"], times["afternoon"], times["evening"],
|
||||
times["sunset"], times["night_twilight"], times["night"]
|
||||
]
|
||||
|
||||
let imageSet = [
|
||||
this.img_morning_twilight, this.img_sunrise, this.img_morning,
|
||||
this.img_noon, this.img_afternoon, this.img_evening,
|
||||
this.img_sunset, this.img_night_twilight, this.img_night
|
||||
]
|
||||
|
||||
for(let i = 0; i < timesArray.length; i++) {
|
||||
if(timesArray[i][0] <= now && now <= timesArray[i][1] && i != lastDayTime) {
|
||||
global.log(PATH + "/res/images/selected/" + imageSet[i])
|
||||
this.changeWallpaper("file://" + PATH + "/images/selected/" + imageSet[i])
|
||||
|
||||
lastDayTime = i
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function convertToTimeString(time) {
|
||||
return time.getHours().toString().padStart(2, "0") + ":" + time.getMinutes().toString().padStart(2, "0")
|
||||
}
|
||||
|
||||
this.tvTimes =
|
||||
"Morning Twilight:\t\t" + convertToTimeString(timesArray[0][0]) + " - " + convertToTimeString(timesArray[0][1]) +
|
||||
"\nSunrise:\t\t\t\t" + convertToTimeString(timesArray[1][0]) + " - " + convertToTimeString(timesArray[1][1]) +
|
||||
"\nMorning:\t\t\t" + convertToTimeString(timesArray[2][0]) + " - " + convertToTimeString(timesArray[2][1]) +
|
||||
"\nNoon:\t\t\t\t" + convertToTimeString(timesArray[3][0]) + " - " + convertToTimeString(timesArray[3][1]) +
|
||||
"\nAfternoon:\t\t\t" + convertToTimeString(timesArray[4][0]) + " - " + convertToTimeString(timesArray[4][1]) +
|
||||
"\nEvening:\t\t\t" + convertToTimeString(timesArray[5][0]) + " - " + convertToTimeString(timesArray[5][1]) +
|
||||
"\nSunset:\t\t\t\t" + convertToTimeString(timesArray[6][0]) + " - " + convertToTimeString(timesArray[6][1]) +
|
||||
"\nNight Twilight:\t\t" + convertToTimeString(timesArray[7][0]) + " - " + convertToTimeString(timesArray[7][1]) +
|
||||
"\nNight:\t\t\t\t" + convertToTimeString(timesArray[8][0]) + " - " + convertToTimeString(timesArray[8][1])
|
||||
},
|
||||
|
||||
|
||||
updateLocation: function () {
|
||||
if (this.autolocation) {
|
||||
let loc = location.estimateLocation()
|
||||
this.latitude = loc["latitude"]
|
||||
this.longitude = loc["longitude"]
|
||||
} else {
|
||||
this.latitude = this.latitude
|
||||
this.longitude = this.longitude
|
||||
}
|
||||
|
||||
// Refresh the image information, if it's necessary
|
||||
this.setImageToTime()
|
||||
|
||||
// Update the update information
|
||||
lastLocationUpdate = new Date()
|
||||
},
|
||||
|
||||
|
||||
/******************** UI Callbacks ********************/
|
||||
|
||||
/**
|
||||
* Callback for settings-schema
|
||||
* Opens the external heic-importer window
|
||||
*/
|
||||
openImageConfigurator: function() {
|
||||
Util.spawnCommandLine("/usr/bin/env python3 " + DIRECTORY.path + "/image-configurator/image-configurator.py");
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Callback for settings-schema
|
||||
* Opens the browser and navigate to the URL of the respository
|
||||
*/
|
||||
openRepoWebsite: function() {
|
||||
Util.spawnCommandLine("xdg-open https://github.com/TobiZog/cinnamon-dynamic-wallpaper");
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Main loop
|
||||
*/
|
||||
_loop: function() {
|
||||
if(looping) {
|
||||
this.setImageToTime()
|
||||
|
||||
if (lastLocationUpdate < new Date().getTime() - this.locationRefreshTime * 1000) {
|
||||
this.updateLocation()
|
||||
lastLocationUpdate = new Date()
|
||||
}
|
||||
|
||||
// Refresh every 60 seconds
|
||||
Mainloop.timeout_add_seconds(60, Lang.bind(this, this._loop));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************** 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");
|
||||
}
|
||||
|
||||
// Display the welcome notification on activation
|
||||
// extension.showNotification(
|
||||
// APPNAME,
|
||||
// "Welcome to " + APPNAME + "! Open the settings and configure the extensions.",
|
||||
// true
|
||||
// );
|
||||
|
||||
return extension;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lifecycle function on disable
|
||||
*/
|
||||
function disable() {
|
||||
looping = false
|
||||
}
|
||||
1
cinnamon-dynamic-wallpaper@TobiZog/5.4/icon.png
Symbolic link
@@ -0,0 +1 @@
|
||||
icons/icon.png
|
||||
BIN
cinnamon-dynamic-wallpaper@TobiZog/5.4/icons/icon.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
pref_path = "/.config/cinnamon/spices/cinnamon-dynamic-wallpaper@TobiZog/cinnamon-dynamic-wallpaper@TobiZog.json"
|
||||
@@ -0,0 +1,925 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.40.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.24"/>
|
||||
<object class="GtkFileFilter" id="filefilter1">
|
||||
<patterns>
|
||||
<pattern>*.heic</pattern>
|
||||
</patterns>
|
||||
</object>
|
||||
<object class="GtkScrolledWindow" id="page_config">
|
||||
<property name="width-request">100</property>
|
||||
<property name="height-request">80</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="vscroll-policy">natural</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">8</property>
|
||||
<property name="margin-end">8</property>
|
||||
<property name="margin-top">8</property>
|
||||
<property name="margin-bottom">8</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">4</property>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label-xalign">0.009999999776482582</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="left-padding">8</property>
|
||||
<property name="right-padding">8</property>
|
||||
<child>
|
||||
<!-- n-columns=2 n-rows=2 -->
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">8</property>
|
||||
<property name="margin-end">8</property>
|
||||
<property name="margin-top">8</property>
|
||||
<property name="margin-bottom">8</property>
|
||||
<property name="row-spacing">8</property>
|
||||
<property name="column-spacing">8</property>
|
||||
<property name="column-homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">Use an included or a custom image set?</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="rb_included_image_set">
|
||||
<property name="label" translatable="yes">Use an included image set</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw-indicator">True</property>
|
||||
<signal name="toggled" handler="onRadioImageSet" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="rb_external_image_set">
|
||||
<property name="label" translatable="yes">Import a heic-file</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw-indicator">True</property>
|
||||
<property name="group">rb_included_image_set</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">4</property>
|
||||
<property name="margin-end">4</property>
|
||||
<property name="label" translatable="yes">Image Source</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label-xalign">0.009999999776482582</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="left-padding">8</property>
|
||||
<property name="right-padding">8</property>
|
||||
<child>
|
||||
<!-- n-columns=2 n-rows=2 -->
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">8</property>
|
||||
<property name="margin-end">8</property>
|
||||
<property name="margin-top">8</property>
|
||||
<property name="margin-bottom">8</property>
|
||||
<property name="row-spacing">8</property>
|
||||
<property name="column-spacing">8</property>
|
||||
<property name="column-homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lb_image_set">
|
||||
<property name="height-request">36</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">Select an image-set</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFileChooserButton" id="fc_heic_file">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="no-show-all">True</property>
|
||||
<property name="filter">filefilter1</property>
|
||||
<property name="title" translatable="yes"/>
|
||||
<signal name="file-set" handler="onHeifSelected" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lb_heic_file">
|
||||
<property name="height-request">36</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="no-show-all">True</property>
|
||||
<property name="label" translatable="yes">Choose the file, which you want to use</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="cb_image_set">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<signal name="changed" handler="onImageSetSelected" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">4</property>
|
||||
<property name="margin-end">4</property>
|
||||
<property name="label" translatable="yes">Image Set</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="label-xalign">0.009999999776482582</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="bottom-padding">8</property>
|
||||
<property name="left-padding">8</property>
|
||||
<property name="right-padding">8</property>
|
||||
<child>
|
||||
<!-- n-columns=3 n-rows=3 -->
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="row-spacing">8</property>
|
||||
<property name="column-spacing">8</property>
|
||||
<property name="row-homogeneous">True</property>
|
||||
<property name="column-homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label-xalign">0.5</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="top-padding">8</property>
|
||||
<property name="bottom-padding">8</property>
|
||||
<property name="left-padding">8</property>
|
||||
<property name="right-padding">8</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">8</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="img_preview_1">
|
||||
<property name="width-request">300</property>
|
||||
<property name="height-request">200</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
<property name="pixel-size">30</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="cb_preview_1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">4</property>
|
||||
<property name="margin-end">4</property>
|
||||
<property name="label" translatable="yes">Morning Twilight</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label-xalign">0.5</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="top-padding">8</property>
|
||||
<property name="bottom-padding">8</property>
|
||||
<property name="left-padding">8</property>
|
||||
<property name="right-padding">8</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">8</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="img_preview_2">
|
||||
<property name="width-request">300</property>
|
||||
<property name="height-request">200</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="cb_preview_2">
|
||||
<property name="can-focus">False</property>
|
||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">4</property>
|
||||
<property name="margin-end">4</property>
|
||||
<property name="label" translatable="yes">Sunrise</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label-xalign">0.5</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="top-padding">8</property>
|
||||
<property name="bottom-padding">8</property>
|
||||
<property name="left-padding">8</property>
|
||||
<property name="right-padding">8</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">8</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="img_preview_3">
|
||||
<property name="width-request">300</property>
|
||||
<property name="height-request">200</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="cb_preview_3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">4</property>
|
||||
<property name="margin-end">4</property>
|
||||
<property name="label" translatable="yes">Morning</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label-xalign">0.5</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="top-padding">8</property>
|
||||
<property name="bottom-padding">8</property>
|
||||
<property name="left-padding">8</property>
|
||||
<property name="right-padding">8</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">8</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="img_preview_4">
|
||||
<property name="width-request">300</property>
|
||||
<property name="height-request">200</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="cb_preview_4">
|
||||
<property name="can-focus">False</property>
|
||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">4</property>
|
||||
<property name="margin-end">4</property>
|
||||
<property name="label" translatable="yes">Noon</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label-xalign">0.5</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="top-padding">8</property>
|
||||
<property name="bottom-padding">8</property>
|
||||
<property name="left-padding">8</property>
|
||||
<property name="right-padding">8</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">8</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="img_preview_5">
|
||||
<property name="width-request">300</property>
|
||||
<property name="height-request">200</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="cb_preview_5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">4</property>
|
||||
<property name="margin-end">4</property>
|
||||
<property name="label" translatable="yes">Afternoon</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label-xalign">0.5</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="top-padding">8</property>
|
||||
<property name="bottom-padding">8</property>
|
||||
<property name="left-padding">8</property>
|
||||
<property name="right-padding">8</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">8</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="img_preview_6">
|
||||
<property name="width-request">300</property>
|
||||
<property name="height-request">200</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="cb_preview_6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">4</property>
|
||||
<property name="margin-end">4</property>
|
||||
<property name="label" translatable="yes">Evening</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label-xalign">0.5</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="top-padding">8</property>
|
||||
<property name="bottom-padding">8</property>
|
||||
<property name="left-padding">8</property>
|
||||
<property name="right-padding">8</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">8</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="img_preview_7">
|
||||
<property name="width-request">300</property>
|
||||
<property name="height-request">200</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="cb_preview_7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">4</property>
|
||||
<property name="margin-end">4</property>
|
||||
<property name="label" translatable="yes">Sunset</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label-xalign">0.5</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="top-padding">8</property>
|
||||
<property name="bottom-padding">8</property>
|
||||
<property name="left-padding">8</property>
|
||||
<property name="right-padding">8</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">8</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="img_preview_8">
|
||||
<property name="width-request">300</property>
|
||||
<property name="height-request">200</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="cb_preview_8">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">4</property>
|
||||
<property name="margin-end">4</property>
|
||||
<property name="label" translatable="yes">Night Twilight</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label-xalign">0.5</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="top-padding">8</property>
|
||||
<property name="bottom-padding">8</property>
|
||||
<property name="left-padding">8</property>
|
||||
<property name="right-padding">8</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">8</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="img_preview_9">
|
||||
<property name="width-request">300</property>
|
||||
<property name="height-request">200</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="cb_preview_9">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<signal name="changed" handler="onPreviewComboboxSelected" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">4</property>
|
||||
<property name="margin-end">4</property>
|
||||
<property name="label" translatable="yes">Night</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">4</property>
|
||||
<property name="margin-end">4</property>
|
||||
<property name="label" translatable="yes">Preview</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkWindow" id="main_window">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="window-position">center</property>
|
||||
<property name="default-width">1024</property>
|
||||
<property name="default-height">768</property>
|
||||
<property name="icon">../icons/icon.png</property>
|
||||
<signal name="destroy" handler="onDestroy" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack_main">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="transition-type">crossfade</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="title" translatable="yes">Cinnamon Dynamic Wallpaper</property>
|
||||
<property name="subtitle" translatable="yes">Image Configuration</property>
|
||||
<property name="show-close-button">True</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">gtk-apply</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="use-stock">True</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="clicked" handler="onApply" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkBox" id="page_load">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">8</property>
|
||||
<property name="margin-end">8</property>
|
||||
<property name="margin-top">8</property>
|
||||
<property name="margin-bottom">8</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">8</property>
|
||||
<child>
|
||||
<object class="GtkSpinner">
|
||||
<property name="height-request">64</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="active">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">Proceeding...</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -0,0 +1,374 @@
|
||||
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 ImageConfigurator:
|
||||
def __init__(self) -> None:
|
||||
########### Class variables ###########
|
||||
self.pref_vars = [
|
||||
"etr_img_morning_twilight",
|
||||
"etr_img_sunrise",
|
||||
"etr_img_morning",
|
||||
"etr_img_noon",
|
||||
"etr_img_afternoon",
|
||||
"etr_img_evening",
|
||||
"etr_img_sunset",
|
||||
"etr_img_night_twilight",
|
||||
"etr_img_night"
|
||||
]
|
||||
|
||||
self.img_sets = [
|
||||
"aurora",
|
||||
"beach",
|
||||
"bitday",
|
||||
"cliffs",
|
||||
"gradient",
|
||||
"lakeside",
|
||||
"mountains",
|
||||
"sahara"
|
||||
]
|
||||
|
||||
########### Create the folder ###########
|
||||
try:
|
||||
os.mkdir(IMAGE_EXTRACT_DIR)
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
os.mkdir(IMAGE_SELECTED_DIR)
|
||||
except:
|
||||
pass
|
||||
|
||||
########### GTK stuff ###########
|
||||
self.builder = Gtk.Builder()
|
||||
self.builder.add_from_file(UI_PATH)
|
||||
self.builder.connect_signals(self)
|
||||
|
||||
########### Glade Ressources ###########
|
||||
self.rb_included_image_set = self.builder.get_object("rb_included_image_set")
|
||||
self.rb_external_image_set = self.builder.get_object("rb_external_image_set")
|
||||
|
||||
self.lb_image_set = self.builder.get_object("lb_image_set")
|
||||
self.cb_image_set = self.builder.get_object("cb_image_set")
|
||||
|
||||
self.lb_heic_file = self.builder.get_object("lb_heic_file")
|
||||
self.fc_heic_file = self.builder.get_object("fc_heic_file")
|
||||
|
||||
self.img_previews = [
|
||||
self.builder.get_object("img_preview_1"),
|
||||
self.builder.get_object("img_preview_2"),
|
||||
self.builder.get_object("img_preview_3"),
|
||||
self.builder.get_object("img_preview_4"),
|
||||
self.builder.get_object("img_preview_5"),
|
||||
self.builder.get_object("img_preview_6"),
|
||||
self.builder.get_object("img_preview_7"),
|
||||
self.builder.get_object("img_preview_8"),
|
||||
self.builder.get_object("img_preview_9")
|
||||
]
|
||||
|
||||
self.cb_previews = [
|
||||
self.builder.get_object("cb_preview_1"),
|
||||
self.builder.get_object("cb_preview_2"),
|
||||
self.builder.get_object("cb_preview_3"),
|
||||
self.builder.get_object("cb_preview_4"),
|
||||
self.builder.get_object("cb_preview_5"),
|
||||
self.builder.get_object("cb_preview_6"),
|
||||
self.builder.get_object("cb_preview_7"),
|
||||
self.builder.get_object("cb_preview_8"),
|
||||
self.builder.get_object("cb_preview_9")
|
||||
]
|
||||
|
||||
# The GtkStack
|
||||
self.stack_main = self.builder.get_object("stack_main")
|
||||
self.stack_main.add_named(self.builder.get_object("page_config"), "config")
|
||||
self.stack_main.add_named(self.builder.get_object("page_load"), "load")
|
||||
self.stack_main.set_visible_child_name("config")
|
||||
|
||||
|
||||
########### Load predefinitions and settings ###########
|
||||
for set in self.img_sets:
|
||||
self.cb_image_set.append_text(set)
|
||||
|
||||
self.image_source = Source.SELECTED
|
||||
|
||||
|
||||
# Check for Cinnamon version
|
||||
# With version 5.6+, the folder of the configuration file was changed
|
||||
version = subprocess.check_output(["cinnamon", "--version"])
|
||||
version = version.decode()
|
||||
version = version[version.find(" "):version.rfind("\n")].strip()
|
||||
|
||||
# Load preferences
|
||||
self.loadFromSettings()
|
||||
|
||||
|
||||
def showMainWindow(self):
|
||||
""" Opens the main window, starts the Gtk main routine
|
||||
"""
|
||||
window = self.builder.get_object("main_window")
|
||||
window.show_all()
|
||||
|
||||
self.imageSetVisibility(self.image_source)
|
||||
self.rb_external_image_set.set_active(self.image_source == Source.EXTRACT)
|
||||
|
||||
Gtk.main()
|
||||
|
||||
|
||||
def loadFromSettings(self):
|
||||
""" Load preferences from the Cinnamon preference file
|
||||
"""
|
||||
# Load the settings
|
||||
with open(PREF_PATH, "r") as pref_file:
|
||||
pref_data = json.load(pref_file)
|
||||
|
||||
|
||||
# Get all images in the "selected" folder
|
||||
choosable_images = os.listdir(IMAGE_SELECTED_DIR)
|
||||
choosable_images.sort()
|
||||
|
||||
|
||||
# Add the founded image names to the ComboBoxes
|
||||
if pref_data["etr_choosen_image_set"]["value"] == "custom":
|
||||
for combobox in self.cb_previews:
|
||||
for option in choosable_images:
|
||||
combobox.append_text(option)
|
||||
else:
|
||||
for i, set in enumerate(self.img_sets):
|
||||
if set == pref_data["etr_choosen_image_set"]["value"]:
|
||||
self.cb_image_set.set_active(i)
|
||||
|
||||
|
||||
for i, val in enumerate(self.pref_vars):
|
||||
# Set the preview image
|
||||
self.changePreviewImage(i, IMAGE_SELECTED_DIR + pref_data[val]['value'])
|
||||
|
||||
# Set the ComboBox selection
|
||||
if pref_data["etr_choosen_image_set"]["value"] == "custom":
|
||||
self.image_source = Source.EXTRACT
|
||||
|
||||
for j, set in enumerate(choosable_images):
|
||||
if set == pref_data[val]["value"]:
|
||||
self.cb_previews[i].set_active(j)
|
||||
else:
|
||||
self.image_source = Source.SET
|
||||
|
||||
|
||||
def writeToSettings(self):
|
||||
""" Save preferences to the Cinnamon preference file
|
||||
"""
|
||||
# Load the settings
|
||||
with open(PREF_PATH, "r") as pref_file:
|
||||
pref_data = json.load(pref_file)
|
||||
|
||||
|
||||
# Update the settings
|
||||
if self.image_source == Source.SET:
|
||||
pref_data["etr_choosen_image_set"]["value"] = self.cb_image_set.get_active_text()
|
||||
|
||||
for i, val in enumerate(self.pref_vars):
|
||||
pref_data[val]['value'] = str(i + 1) + ".jpg"
|
||||
else:
|
||||
pref_data["etr_choosen_image_set"]["value"] = "custom"
|
||||
|
||||
for i, val in enumerate(self.pref_vars):
|
||||
pref_data[val]['value'] = self.cb_previews[i].get_active_text()
|
||||
|
||||
|
||||
# Write the settings
|
||||
with open(PREF_PATH, "w") as pref_file:
|
||||
json.dump(pref_data, pref_file, separators=(',', ':'), indent=4)
|
||||
|
||||
|
||||
def changePreviewImage(self, imageId: int, imageURI: str):
|
||||
""" Exchanges the image in the preview
|
||||
|
||||
Args:
|
||||
imageId (int): The number of the preview (0-8)
|
||||
imageURI (str): URI to the new image
|
||||
"""
|
||||
try:
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file(imageURI)
|
||||
pixbuf = pixbuf.scale_simple(300, 200, GdkPixbuf.InterpType.BILINEAR)
|
||||
|
||||
self.img_previews[imageId].set_from_pixbuf(pixbuf)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def extractHeifImages(self, imageURI: str):
|
||||
""" Extract all images in a heif file
|
||||
|
||||
Args:
|
||||
imageURI (str): URI to the heif file
|
||||
"""
|
||||
imageURI = imageURI.replace("%20", "\ ")
|
||||
|
||||
filename = imageURI[imageURI.rfind("/") + 1:imageURI.rfind(".")]
|
||||
|
||||
self.image_source = Source.EXTRACT
|
||||
|
||||
self.wipeImages(Source.EXTRACT)
|
||||
os.system("heif-convert " + imageURI + " " + IMAGE_EXTRACT_DIR + "/" + filename + ".jpg")
|
||||
|
||||
self.createExtracted()
|
||||
|
||||
|
||||
def wipeImages(self, source: Source):
|
||||
""" Removes all image of a folder
|
||||
|
||||
Args:
|
||||
source (Source): Choose the folder by selecting the Source
|
||||
"""
|
||||
if source == Source.EXTRACT:
|
||||
dir = IMAGE_EXTRACT_DIR + "*"
|
||||
elif source == Source.SELECTED:
|
||||
dir = IMAGE_SELECTED_DIR + "*"
|
||||
|
||||
for file in glob.glob(dir):
|
||||
os.remove(file)
|
||||
|
||||
|
||||
def createExtracted(self):
|
||||
""" Create the extracted images array
|
||||
"""
|
||||
try:
|
||||
if self.image_source == Source.SELECTED:
|
||||
self.extracted = os.listdir(IMAGE_SELECTED_DIR)
|
||||
elif self.image_source == Source.EXTRACT:
|
||||
self.extracted = os.listdir(IMAGE_EXTRACT_DIR)
|
||||
|
||||
self.extracted.sort()
|
||||
|
||||
for combobox in self.cb_previews:
|
||||
for option in self.extracted:
|
||||
combobox.append_text(option)
|
||||
except:
|
||||
pass
|
||||
|
||||
self.stack_main.set_visible_child_name("config")
|
||||
|
||||
|
||||
def copyToSelected(self, source: Source):
|
||||
""" Copies the extracted images to "res/"
|
||||
"""
|
||||
# Clean the "selected folder up"
|
||||
self.wipeImages(Source.SELECTED)
|
||||
|
||||
# Estimate the source folder
|
||||
if source == Source.EXTRACT:
|
||||
source_folder = IMAGE_EXTRACT_DIR
|
||||
else:
|
||||
source_folder = IMAGE_SETS_DIR + self.cb_image_set.get_active_text() + "/"
|
||||
|
||||
# Copy it to "selected/"
|
||||
for image in os.listdir(source_folder):
|
||||
shutil.copy(source_folder + image, IMAGE_SELECTED_DIR + image)
|
||||
|
||||
|
||||
def imageSetVisibility(self, source: Source):
|
||||
""" Toggle the visibility of the option in the "Image set" box
|
||||
|
||||
Args:
|
||||
source (Source): Toggle by type of Source
|
||||
"""
|
||||
self.image_source = source
|
||||
|
||||
self.lb_image_set.set_visible(source == Source.SET)
|
||||
self.cb_image_set.set_visible(source == Source.SET)
|
||||
|
||||
self.lb_heic_file.set_visible(source != Source.SET)
|
||||
self.fc_heic_file.set_visible(source != Source.SET)
|
||||
|
||||
for i in range(0, 9):
|
||||
self.cb_previews[i].set_visible(source != Source.SET)
|
||||
|
||||
|
||||
|
||||
########## UI Signals ##########
|
||||
|
||||
def onImageSetSelected(self, cb):
|
||||
""" UI signal if the image set combo box value changed
|
||||
|
||||
Args:
|
||||
cb (GtkComboBox): The active ComboBox
|
||||
"""
|
||||
if self.image_source != Source.SELECTED:
|
||||
set_name = cb.get_active_text()
|
||||
|
||||
for i, _ in enumerate(self.img_previews):
|
||||
self.changePreviewImage(i, IMAGE_SETS_DIR + set_name + "/" + str(i + 1) + ".jpg")
|
||||
|
||||
|
||||
def onRadioImageSet(self, rb):
|
||||
""" UI signal if the radio buttons are toggled
|
||||
|
||||
Args:
|
||||
rb (GtkRadioButton): The toggled RadioButton
|
||||
"""
|
||||
if rb.get_active():
|
||||
self.imageSetVisibility(Source.SET)
|
||||
else:
|
||||
self.imageSetVisibility(Source.EXTRACT)
|
||||
|
||||
|
||||
def onHeifSelected(self, fc):
|
||||
""" UI signal if the filechooser has a file selected
|
||||
|
||||
Args:
|
||||
fc (filechooser): The selected filechooser
|
||||
"""
|
||||
# Get the URI to the file
|
||||
uri = fc.get_file().get_uri()
|
||||
uri = uri[7:]
|
||||
|
||||
self.stack_main.set_visible_child_name("load")
|
||||
|
||||
thread = threading.Thread(target=self.extractHeifImages, args=(uri, ))
|
||||
thread.daemon = True
|
||||
thread.start()
|
||||
|
||||
|
||||
def onPreviewComboboxSelected(self, cb):
|
||||
""" UI signal if one of the preview combobox is selected
|
||||
|
||||
Args:
|
||||
cb (ComboBox): The selected combobox
|
||||
"""
|
||||
number = Gtk.Buildable.get_name(cb)
|
||||
number = number[number.rfind("_") + 1:]
|
||||
|
||||
if self.image_source == Source.EXTRACT:
|
||||
self.changePreviewImage(int(number) - 1, IMAGE_EXTRACT_DIR + cb.get_active_text())
|
||||
|
||||
|
||||
def onApply(self, *args):
|
||||
""" UI signal if the user presses the "Apply" button
|
||||
"""
|
||||
self.writeToSettings()
|
||||
self.copyToSelected(self.image_source)
|
||||
|
||||
Gtk.main_quit()
|
||||
|
||||
|
||||
def onDestroy(self, *args):
|
||||
""" UI signal if the window is closed by the user
|
||||
"""
|
||||
Gtk.main_quit()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ic = ImageConfigurator()
|
||||
ic.showMainWindow()
|
||||
|
After Width: | Height: | Size: 454 KiB |
|
After Width: | Height: | Size: 488 KiB |
|
After Width: | Height: | Size: 436 KiB |
|
After Width: | Height: | Size: 436 KiB |
|
After Width: | Height: | Size: 470 KiB |
|
After Width: | Height: | Size: 435 KiB |
|
After Width: | Height: | Size: 426 KiB |
|
After Width: | Height: | Size: 420 KiB |
|
After Width: | Height: | Size: 485 KiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
@@ -0,0 +1 @@
|
||||
1.jpg
|
||||
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 513 KiB |
|
After Width: | Height: | Size: 1012 KiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 695 KiB |
|
After Width: | Height: | Size: 710 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 352 KiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
@@ -0,0 +1 @@
|
||||
4.jpg
|
||||
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 238 KiB |
|
After Width: | Height: | Size: 241 KiB |
|
After Width: | Height: | Size: 293 KiB |
|
After Width: | Height: | Size: 183 KiB |
|
After Width: | Height: | Size: 211 KiB |
|
After Width: | Height: | Size: 210 KiB |
|
After Width: | Height: | Size: 249 KiB |
|
After Width: | Height: | Size: 182 KiB |
|
After Width: | Height: | Size: 163 KiB |
|
After Width: | Height: | Size: 449 KiB |
|
After Width: | Height: | Size: 558 KiB |
|
After Width: | Height: | Size: 681 KiB |
|
After Width: | Height: | Size: 654 KiB |
|
After Width: | Height: | Size: 631 KiB |
|
After Width: | Height: | Size: 548 KiB |
|
After Width: | Height: | Size: 540 KiB |
|
After Width: | Height: | Size: 465 KiB |
|
After Width: | Height: | Size: 392 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 119 KiB |
|
After Width: | Height: | Size: 119 KiB |
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 135 KiB |
|
After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 108 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 93 KiB |
14
cinnamon-dynamic-wallpaper@TobiZog/5.4/scripts/location.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const Soup = imports.gi.Soup;
|
||||
|
||||
|
||||
function estimateLocation() {
|
||||
let sessionSync = new Soup.SessionSync();
|
||||
let msg = Soup.Message.new('GET', "https://get.geojs.io/v1/ip/geo.json");
|
||||
sessionSync.send_message(msg);
|
||||
|
||||
if (msg.status_code == 200) {
|
||||
return JSON.parse(msg.response_body.data);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
158
cinnamon-dynamic-wallpaper@TobiZog/5.4/scripts/suntimes.js
Normal file
@@ -0,0 +1,158 @@
|
||||
/**
|
||||
* @name Cinnamon-Dynamic-Wallpaper
|
||||
* @alias TobiZog
|
||||
* @since 2023
|
||||
*/
|
||||
|
||||
const DAYPERIOD = {
|
||||
MTWILIGHT: 0,
|
||||
SUNRISE: 1,
|
||||
MORNING: 2,
|
||||
NOON: 3,
|
||||
AFTERNOON: 4,
|
||||
EVENING: 5,
|
||||
SUNSET: 6,
|
||||
NTWILIGHT: 7,
|
||||
NIGHT: 8,
|
||||
NONE: 10
|
||||
}
|
||||
|
||||
const DAYMS = 1000 * 60 * 60 * 24
|
||||
const J1970 = 2440588
|
||||
const J2000 = 2451545
|
||||
|
||||
|
||||
function fromJulian(j) {
|
||||
let ms_date = (j + 0.5 - J1970) * DAYMS
|
||||
return new Date(ms_date)
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculating specific events of the sun during a day
|
||||
*
|
||||
* @param {float} latitude Location latitude
|
||||
* @param {float} longitude Location longitude
|
||||
*
|
||||
* @returns List of sun events in a day: dawn, sunrise, noon, sunset, dusk
|
||||
*/
|
||||
function sunEventsOfDay(latitude, longitude, date) {
|
||||
let rad = Math.PI / 180
|
||||
let lw = rad * (-longitude)
|
||||
|
||||
let d = (date / DAYMS) - 0.5 + J1970 - J2000
|
||||
let n = Math.round(d - 0.0009 - lw / (2 * Math.PI))
|
||||
let ds = 0.0009 + lw / (2 * Math.PI) + n
|
||||
|
||||
let M = rad * (357.5291 + 0.98560028 * ds)
|
||||
let C = rad * (1.9148 * Math.sin(M) + 0.02 * Math.sin(2 * M) + 0.0003 * Math.sin(3 * M))
|
||||
let P = rad * 102.9372
|
||||
let L = M + C + P + Math.PI
|
||||
|
||||
let dec = Math.asin(Math.sin(rad * 23.4397) * Math.sin(L))
|
||||
|
||||
|
||||
// Angles for the sun
|
||||
let angles = [-0.833, -6]
|
||||
|
||||
for(var i = 0; i < angles.length; i++) {
|
||||
angles[i] = angles[i] * rad
|
||||
angles[i] = Math.acos((Math.sin(angles[i]) - Math.sin(rad * latitude) * Math.sin(dec)) / (Math.cos(rad * latitude) * Math.cos(dec)))
|
||||
angles[i] = 0.0009 + (angles[i] + lw) / (2 * Math.PI) + n
|
||||
}
|
||||
|
||||
let jnoon = J2000 + ds + 0.0053 * Math.sin(M) - 0.0069 * Math.sin(2 * L)
|
||||
|
||||
return {
|
||||
dawn: fromJulian(jnoon - (J2000 + angles[1] + 0.0053 * Math.sin(M) - 0.0069 * Math.sin(2 * L) - jnoon)),
|
||||
sunrise: fromJulian(jnoon - (J2000 + angles[0] + 0.0053 * Math.sin(M) - 0.0069 * Math.sin(2 * L) - jnoon)),
|
||||
noon: fromJulian(jnoon),
|
||||
sunset: fromJulian(J2000 + angles[0] + 0.0053 * Math.sin(M) - 0.0069 * Math.sin(2 * L)),
|
||||
dusk: fromJulian(J2000 + angles[1] + 0.0053 * Math.sin(M) - 0.0069 * Math.sin(2 * L))
|
||||
}
|
||||
}
|
||||
|
||||
function addMinutesToTime(date, minutes = 0) {
|
||||
let newDate = new Date(date)
|
||||
newDate.setMinutes(date.getMinutes() + minutes)
|
||||
return newDate
|
||||
}
|
||||
|
||||
function subTimesToMinutes(date1, date2) {
|
||||
let diff = new Date(date1 - date2)
|
||||
return diff.getUTCHours() * 60 + diff.getMinutes()
|
||||
}
|
||||
|
||||
|
||||
function calcTimePeriod(latitude, longitude) {
|
||||
let todaySunEventsDay = sunEventsOfDay(latitude, longitude, Date.now())
|
||||
let tomorrowSunEventsDay = sunEventsOfDay(latitude, longitude, addMinutesToTime(new Date(), 1440))
|
||||
|
||||
return {
|
||||
morning_twilight: [
|
||||
todaySunEventsDay.dawn,
|
||||
addMinutesToTime(todaySunEventsDay.sunrise, -1)
|
||||
],
|
||||
sunrise: [
|
||||
todaySunEventsDay.sunrise,
|
||||
addMinutesToTime(
|
||||
todaySunEventsDay.sunrise,
|
||||
subTimesToMinutes(todaySunEventsDay.noon, todaySunEventsDay.sunrise) / 8 - 1
|
||||
)
|
||||
],
|
||||
morning: [
|
||||
addMinutesToTime(
|
||||
todaySunEventsDay.sunrise,
|
||||
(subTimesToMinutes(todaySunEventsDay.noon, todaySunEventsDay.sunrise) / 8) * 1
|
||||
),
|
||||
addMinutesToTime(
|
||||
todaySunEventsDay.sunrise,
|
||||
(subTimesToMinutes(todaySunEventsDay.noon, todaySunEventsDay.sunrise) / 8)*6 - 1
|
||||
)
|
||||
],
|
||||
noon: [
|
||||
addMinutesToTime(
|
||||
todaySunEventsDay.sunrise,
|
||||
(subTimesToMinutes(todaySunEventsDay.noon, todaySunEventsDay.sunrise) / 8) * 6
|
||||
),
|
||||
addMinutesToTime(
|
||||
todaySunEventsDay.noon,
|
||||
(subTimesToMinutes(todaySunEventsDay.sunset, todaySunEventsDay.noon) / 8) * 2 - 1
|
||||
)
|
||||
],
|
||||
afternoon: [
|
||||
addMinutesToTime(
|
||||
todaySunEventsDay.noon,
|
||||
(subTimesToMinutes(todaySunEventsDay.sunset, todaySunEventsDay.noon) / 8) * 2
|
||||
),
|
||||
addMinutesToTime(
|
||||
todaySunEventsDay.noon,
|
||||
(subTimesToMinutes(todaySunEventsDay.sunset, todaySunEventsDay.noon) / 8) * 5 - 1
|
||||
)
|
||||
],
|
||||
evening: [
|
||||
addMinutesToTime(
|
||||
todaySunEventsDay.noon,
|
||||
(subTimesToMinutes(todaySunEventsDay.sunset, todaySunEventsDay.noon) / 8) * 5
|
||||
),
|
||||
addMinutesToTime(
|
||||
todaySunEventsDay.noon,
|
||||
(subTimesToMinutes(todaySunEventsDay.sunset, todaySunEventsDay.noon) / 8) * 7 - 1
|
||||
)
|
||||
],
|
||||
sunset: [
|
||||
addMinutesToTime(
|
||||
todaySunEventsDay.noon,
|
||||
(subTimesToMinutes(todaySunEventsDay.sunset, todaySunEventsDay.noon) / 8) * 7 - 1
|
||||
),
|
||||
todaySunEventsDay.sunset
|
||||
],
|
||||
night_twilight: [
|
||||
addMinutesToTime(todaySunEventsDay.sunset, 1),
|
||||
todaySunEventsDay.dusk
|
||||
],
|
||||
night: [
|
||||
addMinutesToTime(todaySunEventsDay.dusk, 1),
|
||||
addMinutesToTime(tomorrowSunEventsDay.dawn, -1)
|
||||
],
|
||||
}
|
||||
}
|
||||
174
cinnamon-dynamic-wallpaper@TobiZog/5.4/settings-schema.json
Normal file
@@ -0,0 +1,174 @@
|
||||
{
|
||||
"layout": {
|
||||
"type": "layout",
|
||||
"pages": [
|
||||
"pg_config",
|
||||
"pg_about"
|
||||
],
|
||||
"pg_config": {
|
||||
"type": "page",
|
||||
"title": "Configuration",
|
||||
"sections": [
|
||||
"sec_image_configuration",
|
||||
"sec_location",
|
||||
"sec_times"
|
||||
]
|
||||
},
|
||||
"pg_about": {
|
||||
"type": "page",
|
||||
"title": "About",
|
||||
"sections": [
|
||||
"sec_project",
|
||||
"sec_github"
|
||||
]
|
||||
},
|
||||
"sec_image_configuration": {
|
||||
"type": "section",
|
||||
"title": "Image set",
|
||||
"keys": [
|
||||
"lb_image_configuration",
|
||||
"btn_config_images"
|
||||
]
|
||||
},
|
||||
"sec_location": {
|
||||
"type": "section",
|
||||
"title": "Location estimation",
|
||||
"keys": [
|
||||
"sw_auto_location",
|
||||
"sc_location_refresh_time",
|
||||
"etr_latitude",
|
||||
"etr_longitude"
|
||||
]
|
||||
},
|
||||
"sec_times": {
|
||||
"type": "section",
|
||||
"title": "Time periods",
|
||||
"keys": [
|
||||
"tv_times"
|
||||
]
|
||||
},
|
||||
"sec_project": {
|
||||
"type": "section",
|
||||
"title": "About the project",
|
||||
"keys": [
|
||||
"lb_about",
|
||||
"lb_author"
|
||||
]
|
||||
},
|
||||
"sec_github": {
|
||||
"type": "section",
|
||||
"title": "Source Code on GitHub",
|
||||
"keys": [
|
||||
"lb_repository",
|
||||
"btn_open_repository"
|
||||
]
|
||||
}
|
||||
},
|
||||
"lb_image_configuration": {
|
||||
"type": "label",
|
||||
"description": "Choose an included image set or import a heic-file with the Image Configurator"
|
||||
},
|
||||
"btn_config_images": {
|
||||
"type": "button",
|
||||
"description": "Image Configurator",
|
||||
"callback": "openImageConfigurator"
|
||||
},
|
||||
"sw_auto_location": {
|
||||
"type": "switch",
|
||||
"default": true,
|
||||
"description": "Estimate coordinates via network"
|
||||
},
|
||||
"sc_location_refresh_time": {
|
||||
"type": "scale",
|
||||
"default": 15,
|
||||
"min": 5,
|
||||
"max": 60,
|
||||
"step": 5,
|
||||
"description": "Interval time to refresh the location via network (min)",
|
||||
"dependency": "sw_auto_location"
|
||||
},
|
||||
"etr_latitude": {
|
||||
"type": "entry",
|
||||
"default": "",
|
||||
"description": "Latitude",
|
||||
"dependency": "!sw_auto_location"
|
||||
},
|
||||
"etr_longitude": {
|
||||
"type": "entry",
|
||||
"default": "",
|
||||
"description": "Longitude",
|
||||
"dependency": "!sw_auto_location"
|
||||
},
|
||||
"tv_times": {
|
||||
"type": "textview",
|
||||
"description": "Time sections today",
|
||||
"default": ""
|
||||
},
|
||||
"lb_about": {
|
||||
"type": "label",
|
||||
"description": "Based on a location, this extension calculates the periods of a day and switch the background image of your Cinnamon desktop. The extension offers the choice between a set of predownloaded wallpapers or to select a custom set of images."
|
||||
},
|
||||
"lb_author": {
|
||||
"type": "label",
|
||||
"description": "Developed by TobiZog"
|
||||
},
|
||||
"lb_repository": {
|
||||
"type": "label",
|
||||
"description": "This project is Open Source. You can visit the whole source code of this extension on GitHub"
|
||||
},
|
||||
"btn_open_repository": {
|
||||
"type": "button",
|
||||
"description": "Open the Repository",
|
||||
"callback": "openRepoWebsite"
|
||||
},
|
||||
"etr_choosen_image_set": {
|
||||
"type": "entry",
|
||||
"default": "",
|
||||
"description": ""
|
||||
},
|
||||
"etr_img_morning_twilight": {
|
||||
"type": "entry",
|
||||
"default": "",
|
||||
"description": ""
|
||||
},
|
||||
"etr_img_sunrise": {
|
||||
"type": "entry",
|
||||
"default": "",
|
||||
"description": ""
|
||||
},
|
||||
"etr_img_morning": {
|
||||
"type": "entry",
|
||||
"default": "",
|
||||
"description": ""
|
||||
},
|
||||
"etr_img_noon": {
|
||||
"type": "entry",
|
||||
"default": "",
|
||||
"description": ""
|
||||
},
|
||||
"etr_img_afternoon": {
|
||||
"type": "entry",
|
||||
"default": "",
|
||||
"description": ""
|
||||
},
|
||||
"etr_img_evening": {
|
||||
"type": "entry",
|
||||
"default": "",
|
||||
"description": ""
|
||||
},
|
||||
"etr_img_sunset": {
|
||||
"type": "entry",
|
||||
"default": "",
|
||||
"description": ""
|
||||
},
|
||||
"etr_img_night_twilight": {
|
||||
"type": "entry",
|
||||
"default": "",
|
||||
"description": ""
|
||||
},
|
||||
"etr_img_night": {
|
||||
"type": "entry",
|
||||
"default": "",
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||