aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LICENSE6
-rw-r--r--bg.jpgbin156967 -> 230938 bytes
-rw-r--r--drop-down.svg4
-rw-r--r--index.html3
-rw-r--r--petrichor.css23
-rw-r--r--petrichor.js55
6 files changed, 67 insertions, 24 deletions
diff --git a/LICENSE b/LICENSE
index f1b6c62..171e2d3 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,3 +1,9 @@
+iec5009.svg: released by its original author into the public domain.
+bg.jpg: derivative work of a file in the public domain.
+drop-down.svg: property of Google Inc.
+
+All remaining files licensed under the following terms:
+
Copyright © 2016 David Phillips. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/bg.jpg b/bg.jpg
index 38a07ff..5ad178e 100644
--- a/bg.jpg
+++ b/bg.jpg
Binary files differ
diff --git a/drop-down.svg b/drop-down.svg
new file mode 100644
index 0000000..9dafd13
--- /dev/null
+++ b/drop-down.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36">
+ <path d="M10.5 15l7.5 7.5 7.5-7.5z"/>
+ <path d="M0 0h36v36h-36z" fill="none"/>
+</svg>
diff --git a/index.html b/index.html
index f424466..9f04ffa 100644
--- a/index.html
+++ b/index.html
@@ -6,7 +6,7 @@
start();
</script>
</head>
- <body onclick="reset();" onload="update_time();">
+ <body onclick="reset();" onload="load();">
<div id="date-container">
<div id="date"></div>
<div id="time"></div>
@@ -20,6 +20,7 @@
<div id="message_container">
<span id="message_label"></span>
</div>
+ <select id="session_list"></select>
<img id="shutdown" src="iec5009.svg" onclick="lightdm.shutdown();" />
</body>
</html>
diff --git a/petrichor.css b/petrichor.css
index f7f10fa..8ad5d38 100644
--- a/petrichor.css
+++ b/petrichor.css
@@ -15,12 +15,12 @@ body,html
#shutdown
{
- cursor: pointer;
- opacity: 0.5;
- width: 96px;
position: absolute;
right: 50px;
bottom: 50px;
+ cursor: pointer;
+ opacity: 0.5;
+ width: 96px;
transition: opacity ease 0.3s;
}
@@ -85,7 +85,7 @@ a.user
{
color: #333;
opacity: inherit;
- background-color: rgba(255,255,255,255,0.2);
+ background-color: #FFF;
padding: 0.2em;
border: 1px solid #DDD;
border-radius: 5px;
@@ -134,3 +134,18 @@ a.user
margin-right: 30px;
font-size: 240px;
}
+
+#session_list
+{
+ position: absolute;
+ top: 50px;
+ left: 50px;
+ border: 1px solid #DDD;
+ border-radius: 5px;
+ padding: 0.2em;
+ color: #333;
+ padding-right: 2em;
+ background: url('drop-down.svg') no-repeat right #FFF;
+ -webkit-appearance: none;
+ -moz-appearance: none; /* only for when testing */
+}
diff --git a/petrichor.js b/petrichor.js
index db05a99..f56d450 100644
--- a/petrichor.js
+++ b/petrichor.js
@@ -66,8 +66,10 @@ function reset()
function authentication_complete()
{
+ sel = document.getElementById('session_list');
+ session = sel.options[sel.selectedIndex].getAttribute('data-sid');
if (lightdm.is_authenticated)
- lightdm.start_session_sync(lightdm.authentication_user, lightdm.default_session);
+ lightdm.start_session_sync(lightdm.authentication_user, session);
else
show_message('<span class="error-icon">&#x26A0;</span> Authentication Failed');
@@ -104,6 +106,16 @@ function countdown()
setTimeout('countdown()', 1000);
}
+function build_session_list()
+{
+ slist = document.getElementById('session_list');
+ slist.innerHTML = "";
+ for (session of lightdm.sessions)
+ {
+ slist.innerHTML += "<option data-sid="+session.key+">"+session.name+"</option>";
+ }
+}
+
function update_time()
{
var days = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
@@ -123,28 +135,33 @@ function update_time()
function start()
{
- document.write('<div id="users">');
- for (i in lightdm.users)
- {
- user = lightdm.users[i];
+ document.write('<div id="users">');
+ for (i in lightdm.users)
+ {
+ user = lightdm.users[i];
- if (user.image.match(/\.face$/))
- image = '/usr/share/icons/Adwaita/256x256/emotes/face-laugh.png';
- else
- image = user.image;
+ if (user.image.match(/\.face$/))
+ image = '/usr/share/icons/Adwaita/256x256/emotes/face-laugh.png';
+ else
+ image = user.image;
- document.write('<a href="#" class="user" id="user_' + user.name +'" onclick="start_authentication(\'' + user.name + '\')">');
- document.write('<img class="avatar" src="file:///' + image + '" /><span class="name">'+user.display_name+'</span>');
+ document.write('<a href="#" class="user" id="user_' + user.name +'" onclick="start_authentication(\'' + user.name + '\')">');
+ document.write('<img class="avatar" src="file:///' + image + '" /><span class="name">'+user.display_name+'</span>');
- if (user.name == lightdm.autologin_user && lightdm.autologin_timeout > 0)
- document.write('<span id="countdown_label"></span>');
+ if (user.name == lightdm.autologin_user && lightdm.autologin_timeout > 0)
+ document.write('<span id="countdown_label"></span>');
- document.write('</a>');
- }
- document.write('</div>');
+ document.write('</a>');
+ }
+ document.write('</div>');
+ time_remaining = lightdm.autologin_timeout;
+ if (time_remaining > 0)
+ countdown();
+}
- time_remaining = lightdm.autologin_timeout;
- if (time_remaining > 0)
- countdown();
+function load()
+{
+ update_time();
+ build_session_list();
}