# Moongreet

A greetd greeter for Wayland, built with Python + GTK4 + gtk4-layer-shell.
Part of the Moonarch ecosystem.

## Features

- **greetd IPC** — Communicates via `$GREETD_SOCK` (length-prefixed JSON)
- **User list** — Parsed from `/etc/passwd` (UID 1000–65533)
- **Avatars** — AccountsService icons, `~/.face` fallback, default SVG
- **Sessions** — Discovered from `/usr/share/wayland-sessions/` and `/usr/share/xsessions/`
- **Last user** — Remembered in `/var/cache/moongreet/last-user`
- **Power actions** — Reboot / Shutdown via `loginctl`
- **Layer Shell** — Fullscreen via gtk4-layer-shell

## Requirements

- Python 3.11+
- GTK 4, PyGObject
- gtk4-layer-shell (for Wayland fullscreen)
- greetd

## Installation

```bash
uv pip install .
```

## System Setup

1. Copy configuration:
   ```bash
   sudo mkdir -p /etc/moongreet
   sudo cp config/moongreet.toml /etc/moongreet/moongreet.toml
   ```

2. Edit `/etc/moongreet/moongreet.toml` — set an absolute path for the wallpaper.

3. Create cache directory:
   ```bash
   sudo mkdir -p /var/cache/moongreet
   sudo chown greeter:greeter /var/cache/moongreet
   ```

4. Configure greetd (`/etc/greetd/config.toml`):
   ```ini
   [default_session]
   command = "moongreet"
   user = "greeter"
   ```

## Development

```bash
# Run tests
uv run pytest tests/ -v

# Type checking
uv run pyright src/

# Run locally (without greetd)
uv run moongreet
```

## License

MIT
