# `greetd`

A login screen for greetd: when Strand runs as greetd's greeter, its
socket (`$GREETD_SOCK`) logs a user in and starts their session.
greetd's PAM conversation shows as it goes (`prompt`, `message`), and
each answer is wiped once sent. Once a session starts, Strand exits
so greetd can run it.

| Field | Type | |
| --- | --- | --- |
| `available` | `bool` | greetd answers: Strand runs as its greeter. False otherwise, when every action fails with `error`. |
| `user` | `text` | The user being logged in (`greetd.login(user)`), or "". |
| `prompt` | `text` | What greetd asks ("Password: "), as PAM says it; "" while it asks nothing. |
| `echo` | `bool` | The answer to `prompt` may be shown as it is typed (a visible question, such as a name), not a secret one. |
| `message` | `text` | What PAM last told the user ("Place your finger on the fingerprint reader", "You are required to change your password"), or "". |
| `busy` | `bool` | greetd is busy with a request: checking an answer, starting the session. |
| `failed` | `bool` | The last answer was refused (greetd then asks the same user again), or a login or session could not start; `error` says why. It stays until the next answer or login. |
| `error` | `text` | Why the last request failed, as greetd says it, or "". |

| Method | |
| --- | --- |
| `action login(user: text)` | Starts logging `user` in (a login already under way is dropped): greetd then asks its questions through `prompt`. |
| `action submit(answer: text)` | Answers `prompt` with `answer`: `input { type: password; text: <-> pw; on activate { greetd.submit(pw); pw = "" } }`. One typed after `login(user)` before greetd asks answers its first question when that one is secret (not `echo`), and is dropped when it is visible; one typed while an answer is checked, or after a text PAM showed, is dropped. Pass a password to nothing else: the config is trusted code, and a declared action's arguments can be read by every user in the process list. Only a greetd that root (or Strand's own user) serves is answered. |
| `action start(command: [text])` | Starts `command` as the user's session (`["sway"]`) once the login succeeds: called with the last answer, it waits for greetd to accept it; a login that fails drops it. Strand then exits. Each word is one word, as given (`["sh", "-c", "sway > log"]` for a shell line); greetd runs it after the user's `~/.profile`. |
| `action cancel()` | Drops the login under way. |
