aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/modules')
-rw-r--r--desktop/modules/appearance/WallEngineModule.qml36
-rw-r--r--desktop/modules/appearance/WallEngineTab.qml142
2 files changed, 178 insertions, 0 deletions
diff --git a/desktop/modules/appearance/WallEngineModule.qml b/desktop/modules/appearance/WallEngineModule.qml
new file mode 100644
index 0000000..8357e93
--- /dev/null
+++ b/desktop/modules/appearance/WallEngineModule.qml
@@ -0,0 +1,36 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+import QtQuick
+import "../.."
+
+// The wallpaper engine's page: on or off, the interval, and the two lists.
+Module {
+ name: "wallengine"
+ label: "Wallpaper engine"
+ // nf-fa-shuffle, present in Inconsolata Nerd Font.
+ icon: ""
+ settings: true
+ group: "Appearance"
+ keywords: ["wallpaper", "timer", "rotate", "rotation", "shuffle", "slideshow", "heart"]
+
+ // A singleton is built on first use, and the engine's timer has to run
+ // from the start of the session, page opened or not. Modules exist for
+ // the whole session, so this reference is what starts it.
+ readonly property bool engineOn: WallEngine.on
+
+ page: Component {
+ Page {
+ title: "Wallpaper engine"
+ WallEngineTab { width: parent.width }
+ }
+ }
+}
diff --git a/desktop/modules/appearance/WallEngineTab.qml b/desktop/modules/appearance/WallEngineTab.qml
new file mode 100644
index 0000000..dff9386
--- /dev/null
+++ b/desktop/modules/appearance/WallEngineTab.qml
@@ -0,0 +1,142 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+import QtQuick
+import "../.."
+
+Item {
+ implicitHeight: col.implicitHeight
+
+ Column {
+ id: col
+ width: parent.width
+ spacing: 14
+
+ Row {
+ spacing: 8
+ Toggle {
+ anchors.verticalCenter: parent.verticalCenter
+ checked: WallEngine.on
+ label: "Change the wallpapers every"
+ onToggled: WallEngine.setOn(checked)
+ }
+ Field {
+ anchors.verticalCenter: parent.verticalCenter
+ width: 50
+ value: String(WallEngine.cfg.minutes)
+ onEdited: {
+ WallEngine.setMinutes(Number(value));
+ value = String(WallEngine.cfg.minutes);
+ }
+ }
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ text: "minutes"
+ color: Theme.subtext
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ }
+ Tab {
+ text: "Next"
+ enabled: WallEngine.on && !Wallpapers.applying
+ onClicked: if (enabled) WallEngine.next()
+ }
+ }
+
+ Text {
+ width: col.width
+ wrapMode: Text.Wrap
+ text: "Timer changes recolour the desktop and leave GRUB, the homepage and the login screen alone. "
+ + "Switching off puts back each screen's home wallpaper, the one last applied by hand, with a full run."
+ color: Theme.overlay
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ }
+
+ Repeater {
+ model: [{ which: "H", name: "Horizontal, DP-1" }, { which: "V", name: "Vertical, DP-3" }]
+
+ Column {
+ id: screen
+ required property var modelData
+ readonly property var paths: WallEngine.list(modelData.which)
+ readonly property string home: modelData.which === "V" ? WallEngine.cfg.homeV : WallEngine.cfg.homeH
+ width: col.width
+ spacing: 8
+
+ Text {
+ text: `${screen.modelData.name}: ${screen.paths.length} hearted`
+ + (WallEngine.on && screen.home !== "" ? `, home ${Wallpapers.label(screen.home)}` : "")
+ color: Theme.subtext
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 }
+ }
+
+ Text {
+ visible: screen.paths.length === 0
+ text: "Heart a wallpaper on the Wallpaper page, with this screen selected, to add it."
+ color: Theme.overlay
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ }
+
+ Flow {
+ width: col.width
+ spacing: 8
+
+ Repeater {
+ model: screen.paths
+
+ // Dimmed when the gallery's scan did not find it: the
+ // timer skips it.
+ Rectangle {
+ id: entry
+ required property string modelData
+ width: 192; height: 108 + 20
+ radius: 6
+ color: Qt.alpha(Theme.surface, 0.3)
+ opacity: WallEngine.present(modelData) ? 1 : 0.4
+ clip: true
+
+ Image {
+ id: thumb
+ anchors { top: parent.top; left: parent.left; right: parent.right; margins: 4 }
+ height: 100
+ source: "file://" + entry.modelData
+ asynchronous: true
+ cache: false
+ fillMode: Image.PreserveAspectCrop
+ sourceSize.width: 192
+ }
+ Text {
+ anchors { top: thumb.bottom; left: parent.left; right: parent.right; margins: 4 }
+ elide: Text.ElideMiddle
+ text: Wallpapers.label(entry.modelData)
+ color: Theme.subtext
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 6 }
+ }
+ // nf-fa-xmark: out of the list.
+ Text {
+ anchors { top: parent.top; right: parent.right; margins: 8 }
+ text: ""
+ color: Theme.text
+ style: Text.Outline
+ styleColor: Qt.alpha(Theme.base, 0.6)
+ font { family: Theme.iconFamily; pixelSize: Theme.fontSize }
+ MouseArea {
+ anchors { fill: parent; margins: -4 }
+ cursorShape: Qt.PointingHandCursor
+ onClicked: WallEngine.toggle(entry.modelData, screen.modelData.which)
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}