commit 606f565aeea4884d70d439a379c908e085465bc1 Author: markow Date: Sun Jul 10 21:49:55 2022 +0300 first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/images/default_face.png b/images/default_face.png new file mode 100644 index 0000000..5b91188 Binary files /dev/null and b/images/default_face.png differ diff --git a/images/hibernate.png b/images/hibernate.png new file mode 100644 index 0000000..e61bef3 Binary files /dev/null and b/images/hibernate.png differ diff --git a/images/logo.png b/images/logo.png new file mode 100644 index 0000000..feba5c9 Binary files /dev/null and b/images/logo.png differ diff --git a/images/restart.png b/images/restart.png new file mode 100644 index 0000000..c253a81 Binary files /dev/null and b/images/restart.png differ diff --git a/images/shutdown.png b/images/shutdown.png new file mode 100644 index 0000000..355fff9 Binary files /dev/null and b/images/shutdown.png differ diff --git a/images/sleep.png b/images/sleep.png new file mode 100644 index 0000000..54de1c1 Binary files /dev/null and b/images/sleep.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..1a94466 --- /dev/null +++ b/index.html @@ -0,0 +1,61 @@ + + + + + + + Example Theme + + +
+ + + + + + +
+ + + + + + + + + + + + +
+


+
+

+ + + +
+

+


+
+
+
+
+ + diff --git a/main.js b/main.js new file mode 100644 index 0000000..d356c67 --- /dev/null +++ b/main.js @@ -0,0 +1,127 @@ +const DEFAULT_USER = "defaultUser"; +const DEFAULT_SESSION = "defaultSession"; +const DEFAULT_WALLPAPPER = "defaultWallpapper"; + +function updateDefaults(user, session) { + + localStorage.setItem(DEFAULT_USER, user) + localStorage.setItem(DEFAULT_SESSION, session) + + var wallpapper = document.getElementById("wallpappers").value + if(wallpapper) { + localStorage.setItem(DEFAULT_WALLPAPPER, wallpapper) + } +} + +function dateFormat(date) { + var parts=date.split('.'); + var options = { weekday: 'long', month: 'long', day: 'numeric' }; + var today = new Date('20' + parts[2], parts[1] - 1, parts[0]); + + return today.toLocaleDateString("ru-RU", options); // Saturday, September 17 + //return `${parts[2]}, ${parts[1]} - 1, ${parts[0]}` +} + +function selectItemByValue(elmnt, value){ + + for(var i=0; i < elmnt.options.length; i++) + { + if(elmnt.options[i].value === value) { + elmnt.selectedIndex = i; + break; + } + } +} + +function doLogin() { + var user = document.getElementById("user").textContent + var password = document.getElementById("password").value + var session = document.getElementById("sessions").value + if (!user || !password || !session) { + return false; + } + + lightdm.cancel_authentication() + + lightdm.show_prompt.connect((text, type) => { + lightdm.respond(password); + }) + lightdm.authentication_complete.connect(() => { + lightdm.start_session(session); + }) + + updateDefaults(user, session); + lightdm.authenticate(user) + return false; +} + +function updateUser(username) { + document.getElementById("user-image").src = 'images/default_face.png' + document.getElementById("user").textContent = username + theme_utils.dirlist(`/var/lib/lightdm-data/${username}`, true, (images) => { + if(images) { + for (let i = 0; i < images.length; i++) { + let image = images[i] + if(image.indexOf("/face.png") == image.length - 9) { + document.getElementById("user-image").src = image + return; + } + } + } + }); +} + +function updateWallpapper(wallpapper) { + var body = document.getElementsByTagName('body')[0]; + body.style.backgroundImage = `url(wallpappers/${wallpapper})`; +} + +function initGreeter() { + + let users = lightdm.users + let defaultUser = localStorage.getItem(DEFAULT_USER) || users[0].username; + updateUser(defaultUser); + + let select = document.getElementById('user-dropdown-content') + for (let i = 0; i < users.length; i++) { + var btn = document.createElement('button') + btn.innerHTML = users[i].username + btn.addEventListener("click", () => { + updateUser(users[i].username) + }) + + select.appendChild(btn) + } + + const wallpappers = document.getElementById('wallpappers'); + + wallpappers.addEventListener('change', (event) => { + updateWallpapper(event.target.value); + }); + + let defaultWallpapper = localStorage.getItem(DEFAULT_WALLPAPPER); + if(defaultWallpapper) { + selectItemByValue(wallpappers, defaultWallpapper); + updateWallpapper(defaultWallpapper); + } + + let sessions = lightdm.sessions + let defaultSession = localStorage.getItem(DEFAULT_SESSION) || sessions[0].key; + let sessionsSelect = document.getElementById('sessions') + for (let i = 0; i < sessions.length; i++) { + var opt = document.createElement('option') + opt.innerHTML = sessions[i].key + opt.value = sessions[i].key + if(defaultSession == sessions[i].key) { + opt.selected = true + } + + sessionsSelect.appendChild(opt) + } + sessionsSelect.value = defaultSession; + + document.getElementById("date").textContent=dateFormat(theme_utils.get_current_localized_date()); + document.getElementById("time").textContent=theme_utils.get_current_localized_time(); +} + +window.addEventListener("GreeterReady", initGreeter) diff --git a/style.css b/style.css new file mode 100644 index 0000000..31c2a3f --- /dev/null +++ b/style.css @@ -0,0 +1,224 @@ + +* { + --bg: rgb(255,165,0); + --btbg: gray; + --opacity: 0.9; + --color: white; +} + +html, body { + width: 99.71%; + height: 99.51%; +} + +body { + background-image: url("wallpappers/Rosatomflot.jpg"); + background-repeat: no-repeat; + background-size: 100% 100%; +} + +#submit { + background-color: rgba(255, 140, 0, 1); + border: 0; + color: var(--color); + font-weight:bold; + margin-left: 5px; + box-shadow: 1px 1px 1px black; + border-radius: 5px +} + +#password::placeholder { + font-weight: bold; + opacity: .5; + color: var(--color); +} + +#menu { + margin-top: 5px; + margin-left: 5px; + margin-right: 5px; + margin-bottom: 5px; + height: 100%; +} + +div.wrapper { + height: 100%; + display: flex; + align-items: center; + justify-content: center +} + +div.wrapper table.main { + margin: 0; +} + +input:focus, +select:focus, +option:focus, +textarea:focus, +button:focus { + outline: none; +} + +#date { + color: var(--color); + font-size:10px; + font-weight:bold; + font-style: italic; + text-shadow: 1px 1px 1px #000,0 1px 1px #000, -1px 0 1px #000, 0 -1px 1px #000; +} + +#password, #user, #user option { + background-color: var(--bg); + opacity: var(--opacity); + border: 0; + width: 200px; + margin: 0; + padding: 0; + color: var(--color); +} + +#user, #user option { + font-size:35px; + white-space:nowrap; +} + +#wallpappers, #wallpappers option { + background-color: var(--btbg); + opacity: var(--opacity); + border: 0; + margin: 0; + padding: 0; + font-size:10px; + font-weight:bold; + color: var(--color); +} + +#wallpappers:hover { + color: var(--bg); +} + +select.wallpappers { + /* for Firefox */ + -moz-appearance: none; + /* for Chrome */ + -webkit-appearance: none; +} + +select.wallpappers::-ms-expand { + display: none; +} + +table, tr, td { + border: 0; + border-spacing: 0; + border-collapse: collapse; + margin: 0; + padding: 0; +} + +#buttons { + background-color: gray; + opacity: var(--opacity); + width: 150px; + margin: 0; + padding: 0; +} + +#user_form { + background-color: var(--bg); + opacity: var(--opacity); + width: 400px; + height: 15em; + margin: 0; + padding: 0; + color: var(--color); +} + +#bottom_info { + font-size:10px; + font-weight:bold; + height: 100%; + color: var(--color); + height: 100%; + border: 1; + border-spacing: 1; +} + +#sessions, #sessions option { + background-color: rgba(255, 140, 0, 1); + opacity: 1; + border: 0; + width: 150px; + margin: 0; + padding: 0; + color: var(--color); +} + +#sessions { + box-shadow: 1px 1px 1px black; + border-radius: 5px +} + +#underline { + border-bottom: 2px solid var(--color); + margin-bottom: 5px; +} + +#menu_btn { + border: 0; + background-color: var(--btbg); + opacity: var(--opacity); + color: var(--color); + font: small-caps 15px/1 caption; +} + +#menu_btn:hover { + border: 0; + background-color: var(--btbg); + opacity: var(--opacity); + color: var(--bg); + font: small-caps 15px/1 caption; +} + +.user-dropdown { + display: inline-block; + position: relative; + background-color: var(--bg); + opacity: var(--opacity); +} +.user-dropdown button { + border: 0; + background-color: var(--bg); + opacity: var(--opacity); + color: var(--color); + font-weight:bold; +} +.user-dropdown-content { + display: none; + position: absolute; + width: 100%; + overflow: auto; + box-shadow: 0px 10px 10px 0px rgba(0,0,0,0.4); + background-color: var(--bg); + opacity: var(--opacity); +} +.user-dropdown:hover .user-dropdown-content { + display: block; +} +.user-dropdown-content button { + border: 0; + width:100%; + display: block; + padding: 5px; + text-decoration: none; + text-align: start; + background-color: var(--bg); + opacity: var(--opacity); + color: var(--color); +} +.user-dropdown-content button:hover { + color: #FFFFFF; + background-color: #00A4BD; +} + diff --git a/wallpappers/Arctic.webp b/wallpappers/Arctic.webp new file mode 100644 index 0000000..9b313ff Binary files /dev/null and b/wallpappers/Arctic.webp differ diff --git a/wallpappers/Baikal1.png b/wallpappers/Baikal1.png new file mode 100644 index 0000000..fa86c86 Binary files /dev/null and b/wallpappers/Baikal1.png differ diff --git a/wallpappers/Baikal2.jpg b/wallpappers/Baikal2.jpg new file mode 100644 index 0000000..10ee5b8 Binary files /dev/null and b/wallpappers/Baikal2.jpg differ diff --git a/wallpappers/Baikal3.jpg b/wallpappers/Baikal3.jpg new file mode 100644 index 0000000..0073868 Binary files /dev/null and b/wallpappers/Baikal3.jpg differ diff --git a/wallpappers/Elbrus1.jpg b/wallpappers/Elbrus1.jpg new file mode 100644 index 0000000..7a63393 Binary files /dev/null and b/wallpappers/Elbrus1.jpg differ diff --git a/wallpappers/Elbrus2.jpg b/wallpappers/Elbrus2.jpg new file mode 100644 index 0000000..5ffe198 Binary files /dev/null and b/wallpappers/Elbrus2.jpg differ diff --git a/wallpappers/Elbrus3.jpg b/wallpappers/Elbrus3.jpg new file mode 100644 index 0000000..3eb01db Binary files /dev/null and b/wallpappers/Elbrus3.jpg differ diff --git a/wallpappers/MCST.webp b/wallpappers/MCST.webp new file mode 100644 index 0000000..34d84e8 Binary files /dev/null and b/wallpappers/MCST.webp differ diff --git a/wallpappers/Rosatomflot.jpg b/wallpappers/Rosatomflot.jpg new file mode 100644 index 0000000..f9042a8 Binary files /dev/null and b/wallpappers/Rosatomflot.jpg differ diff --git a/wallpappers/Satelite.jpg b/wallpappers/Satelite.jpg new file mode 100644 index 0000000..838fcc7 Binary files /dev/null and b/wallpappers/Satelite.jpg differ diff --git a/wallpappers/Space_Launch.jpg b/wallpappers/Space_Launch.jpg new file mode 100644 index 0000000..736e0c9 Binary files /dev/null and b/wallpappers/Space_Launch.jpg differ