Compare commits

..

2 Commits

Author SHA1 Message Date
Марков Сергей Викторович 250ef48928 allow to set user wallpapper 2 years ago
Sergey Markov c1241e72b0 readme fix 2 years ago
  1. 2
      README.md
  2. 2
      index.html
  3. 2
      index.yml
  4. 11
      main.js
  5. 20
      secondary.html
  6. 30
      wallpapper.js
  7. 7
      web-greeter-theme-basealt.spec

2
README.md

@ -1,5 +1,5 @@
# Basealt web-greeter-theme
The lightdm web-greeter theme for altlinux OSes
The lightdm web-greeter theme for altlinux OSes<br/>
![](https://git.markow.su/markow/git-utils/raw/branch/master/screenshots/web-greeter-theme-basealt.gif)
# Install

2
index.html

@ -3,6 +3,7 @@
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css" class="style">
<script type="text/javascript" src="wallpapper.js"></script>
<script type="text/javascript" src="main.js"></script>
<title>Example Theme</title>
</head>
@ -32,6 +33,7 @@
<option value="Elbrus1.jpg">Эльбрус - 1</option>
<option value="Elbrus2.jpg">Эльбрус - 2</option>
<option value="Elbrus3.jpg">Эльбрус - 3</option>
<option value="User">Пользовательский</option>
</select>
</dev>
</td>

2
index.yml

@ -1,2 +1,2 @@
primary_html: "index.html"
secondary_html: "index.html"
secondary_html: "secondary.html"

11
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

20
secondary.html

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css" class="style">
<script type="text/javascript" src="wallpapper.js"></script>
<script type="text/javascript">
function initGreeter() {
let defaultWallpapper = window.localStorage.getItem(DEFAULT_WALLPAPPER);
if(defaultWallpapper) {
updateWallpapper(defaultWallpapper);
}
}
window.addEventListener("GreeterReady", initGreeter)
</script>
<title>Example Theme</title>
</head>
<body />
</html>

30
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})`)
}
}

7
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 <sergey@markow.su>
Packager: Sergey-V Markov <markow@altlinux.org>
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 <markow@altlinux.org> 1.0.5-alt1
- Allow to set user wallpapper
* Sun Jan 8 2023 Sergey-V Markov <sergey@markow.su> 1.0.4-alt1
- Bug fix with defaults updating storage

Loading…
Cancel
Save