JezerM
4 years ago
22 changed files with 6359 additions and 548 deletions
@ -0,0 +1,20 @@
|
||||
# Web Greeter for LightDM |
||||
|
||||
A modern, visually appealing greeter for LightDM, that allows to create web based themes with HTML, CSS and JavaScript. |
||||
|
||||
This is a try to update the [Antergos web-greeter](https://github.com/Antergos/web-greeter), following what they left. |
||||
|
||||
## Features |
||||
|
||||
- Create themes with HTML, CSS and JavaScript! |
||||
- Should work everywhere. |
||||
- JavaScript error handling, allowing to load the default theme. |
||||
- Themes could be simple, or very complex. |
||||
- Battery and brightness control. |
||||
|
||||
## Theme JavaScript API |
||||
See the [JavaScript API][jsAPI] here, and some [HOWTO][howto] here too! |
||||
|
||||
|
||||
[jsAPI]: ./api/LightDM.md |
||||
[howto]: ./howto |
@ -0,0 +1,18 @@
|
||||
# Summary |
||||
|
||||
* [Introduction](README.md) |
||||
|
||||
## Javascript API |
||||
* [LightDM](api/LightDM.md) |
||||
* [Greeter](api/Greeter.md) |
||||
* [GreeterConfig](api/GreeterConfig.md) |
||||
* [ThemeUtils](api/ThemeUtils.md) |
||||
* [Battery](api/Battery.md) |
||||
* [Language](api/Language.md) |
||||
* [Layout](api/Layout.md) |
||||
* [Session](api/Session.md) |
||||
* [User](api/User.md) |
||||
* [Signal](api/Signal.md) |
||||
|
||||
## HOWTO |
||||
* [Introduction](howto/intro.md) |
@ -1,7 +1,7 @@
|
||||
<a id="LightDM.Battery"></a> |
||||
|
||||
## LightDM.Battery |
||||
Interface for object that holds info about the battery on the system. This object is not created by the theme's code, but rather by the [`LightDM.Greeter`](#dl-LightDM-Greeter) class. |
||||
Interface for object that holds info about the battery on the system. This object is not created by the theme's code, but rather by the [`LightDM.Greeter`](Greeter.md) class. |
||||
|
||||
<a id="LightDM.Battery+level"></a> |
||||
|
@ -0,0 +1,6 @@
|
||||
<a id="LightDM"></a> |
||||
|
||||
## LightDM : <code>object</code> |
||||
The greeter's Theme JavaScript API. |
||||
Accesible through `lightdm` global variable. |
||||
|
@ -0,0 +1,26 @@
|
||||
<a id="LightDM.Signal"></a> |
||||
|
||||
## LightDM.Signal |
||||
Interface for signals connected to LightDM itself. This is not created by the theme's code, but rather by Web Greeter. |
||||
When Web Greeter triggers the signal, all calbacks are executed. |
||||
|
||||
<a id="LightDM.Signal+connect"></a> |
||||
|
||||
### signal.connect(callback) |
||||
Connects a callback to the signal. |
||||
|
||||
|
||||
| Param | Type | Description | |
||||
| --- | --- | --- | |
||||
| callback | <code>function</code> | The callback to attach. | |
||||
|
||||
<a id="LightDM.Signal+disconnect"></a> |
||||
|
||||
### signal.disconnect(callback) |
||||
Disconnects a callback to the signal. |
||||
|
||||
|
||||
| Param | Type | Description | |
||||
| --- | --- | --- | |
||||
| callback | <code>function</code> | The callback to disattach. | |
||||
|
@ -0,0 +1,51 @@
|
||||
# Introduction |
||||
|
||||
Web Greeter has a simple API, documented here, which allows to communicate to the Web Greeter itself and the LightDM API. |
||||
|
||||
To create a theme, you will need these essential functions: |
||||
|
||||
```javascript |
||||
lightdm.authenticate(username) |
||||
|
||||
lightdm.respond(response) |
||||
|
||||
lightdm.start_session(session) |
||||
``` |
||||
|
||||
### [lightdm.authenticate(username)](/api/Greeter.md#LightDM.Greeter+authenticate) |
||||
This method starts the authentication procedure for a user, allowing to start the user session. |
||||
|
||||
### lightdm.respond(response) |
||||
Provide a response to a prompt. Basically, this acts like a password provider. After the authentication is initiated, you need to provide the user password with this method. It could be "12345", "password", "strongpassword", y'know, a password. |
||||
|
||||
> NOTE: If authentication is not initiated, this will cause an error. |
||||
|
||||
### lightdm.start_session(session) |
||||
Starts a session for the authenticated user. After the user is authenticated, you will need to start the session with this method. |
||||
|
||||
> NOTE: If user is not authenticated, this won't work. |
||||
|
||||
And that's it. You can create a simple javascript file with this: |
||||
```javascript |
||||
lightdm.authenticate("superuser") |
||||
lightdm.respond("superpassword") |
||||
lightdm.start_session("ubuntu") |
||||
``` |
||||
|
||||
Although, if this could really work, it won't at first. The `lightdm` object is not available when the greeter is initiated, it is after a little delay. To make this work, an event is triggered when the API is ready to be used. Add an event listener to the `GreeterReady` event. |
||||
|
||||
```javascript |
||||
window.addEventListener("GreeterReady", initGreeter) |
||||
``` |
||||
|
||||
And so, it will look like this: |
||||
|
||||
```javascript |
||||
function initGreeter() { |
||||
lightdm.authenticate("superuser") |
||||
lightdm.respond("superpassword") |
||||
lightdm.start_session("ubuntu") |
||||
} |
||||
|
||||
window.addEventListener("GreeterReady", initGreeter) |
||||
``` |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue