From 250ef48928042ed9f9f97240671ff9fcd518ca80 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=9C=D0=B0=D1=80=D0=BA=D0=BE=D0=B2=20=D0=A1=D0=B5=D1=80?=
=?UTF-8?q?=D0=B3=D0=B5=D0=B9=20=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80=D0=BE?=
=?UTF-8?q?=D0=B2=D0=B8=D1=87?=
Date: Mon, 3 Apr 2023 18:02:42 +0300
Subject: [PATCH] allow to set user wallpapper
---
index.html | 4 +++-
index.yml | 2 +-
main.js | 11 ++---------
secondary.html | 20 ++++++++++++++++++++
wallpapper.js | 30 ++++++++++++++++++++++++++++++
web-greeter-theme-basealt.spec | 7 +++++--
6 files changed, 61 insertions(+), 13 deletions(-)
create mode 100644 secondary.html
create mode 100644 wallpapper.js
diff --git a/index.html b/index.html
index e07e596..6874c7a 100755
--- a/index.html
+++ b/index.html
@@ -3,7 +3,8 @@
-
+
+
Example Theme
@@ -32,6 +33,7 @@
+
diff --git a/index.yml b/index.yml
index c2d6dab..5b85972 100644
--- a/index.yml
+++ b/index.yml
@@ -1,2 +1,2 @@
primary_html: "index.html"
-secondary_html: "index.html"
+secondary_html: "secondary.html"
diff --git a/main.js b/main.js
index 6b1c457..299efc9 100755
--- a/main.js
+++ b/main.js
@@ -1,7 +1,5 @@
const DEFAULT_USER = "defaultUser";
const DEFAULT_SESSION = "defaultSession";
-const DEFAULT_WALLPAPPER = "defaultWallpapper";
-const WALLPAPPER_ELEMENT = "wallpappers";
const WAITING_CLASS = "waiting";
function togglePasswordVisibility() {
@@ -108,13 +106,6 @@ function updateUser(username) {
updateDefaultsInLocalstorage();
}
-function updateWallpapper(wallpapper) {
- var body = document.getElementsByTagName('body')[0];
- body.style.backgroundImage = `url(wallpappers/${wallpapper})`;
-
- updateDefaultsInLocalstorage();
-}
-
function initGreeter() {
let users = lightdm.users
@@ -136,12 +127,14 @@ function initGreeter() {
wallpappers.addEventListener('change', (event) => {
updateWallpapper(event.target.value);
+ updateDefaultsInLocalstorage();
});
let defaultWallpapper = window.localStorage.getItem(DEFAULT_WALLPAPPER);
if(defaultWallpapper) {
selectItemByValue(wallpappers, defaultWallpapper);
updateWallpapper(defaultWallpapper);
+ updateDefaultsInLocalstorage();
}
let sessions = lightdm.sessions
diff --git a/secondary.html b/secondary.html
new file mode 100644
index 0000000..fa04f82
--- /dev/null
+++ b/secondary.html
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+ Example Theme
+
+
+
diff --git a/wallpapper.js b/wallpapper.js
new file mode 100644
index 0000000..d866c85
--- /dev/null
+++ b/wallpapper.js
@@ -0,0 +1,30 @@
+const DEFAULT_WALLPAPPER = "defaultWallpapper";
+const WALLPAPPER_ELEMENT = "wallpappers";
+
+
+function setWallpapper(wallpapper) {
+ console.log(wallpapper)
+ var body = document.getElementsByTagName('body')[0];
+ body.style.backgroundImage = wallpapper;
+}
+
+function updateWallpapper(wallpapper) {
+ let wall_file = `url(wallpappers/${wallpapper})`
+ if (wallpapper === 'User') {
+ setWallpapper(`url(wallpappers/Rosatomflot.jpg)`)
+ theme_utils.dirlist(`/usr/share/web-greeter/themes/basealt/wallpappers`, true, (images) => {
+ if(images) {
+ console.log(images)
+ for (let i = 0; i < images.length; i++) {
+ let image = images[i]
+ if(image.indexOf("/wallpapper.png") == image.length - 15) {
+ setWallpapper(`url(${image})`)
+ console.log(wall_file)
+ }
+ }
+ }
+ });
+ } else {
+ setWallpapper(`url(wallpappers/${wallpapper})`)
+ }
+}
diff --git a/web-greeter-theme-basealt.spec b/web-greeter-theme-basealt.spec
index 4ad3ce6..9ed1d5d 100644
--- a/web-greeter-theme-basealt.spec
+++ b/web-greeter-theme-basealt.spec
@@ -1,7 +1,7 @@
%define shortname basealt
Name: web-greeter-theme-basealt
-Version: 1.0.4
+Version: 1.0.5
Release: alt1
Summary: A theme for web-greeter on AltLinux
@@ -11,7 +11,7 @@ Group: System/Configuration/Boot and Init
Url: https://git.markow.su/markow/web-greeter-theme-basealt
Source: %name-%version.tar
-Packager: Sergey-V Markov
+Packager: Sergey-V Markov
Requires: lightdm lightdm-webkit2-greeter
@@ -34,6 +34,9 @@ rsync -rv --exclude-from=./.copyignore ./* %buildroot%_datadir/web-greeter/theme
%_datadir/web-greeter/themes/%shortname/*
%changelog
+* Mon Apr 3 2023 Sergey-V Markov 1.0.5-alt1
+- Allow to set user wallpapper
+
* Sun Jan 8 2023 Sergey-V Markov 1.0.4-alt1
- Bug fix with defaults updating storage