feat: deployment-readiness — Assets ins Package, importlib.resources, AUR PKGBUILD
Assets (default-avatar.svg, Icons) von data/ nach src/moongreet/data/ verschoben, damit sie automatisch im Wheel landen. Pfadauflösung in greeter.py und main.py auf importlib.resources umgestellt. Dev-Fallback in config.py entfernt — nur noch /etc/moongreet/moongreet.toml. Beispiel-Configs für System-Deployment und AUR PKGBUILD ergänzt.
This commit is contained in:
parent
806a76e44f
commit
3db69e30bc
@ -17,9 +17,10 @@ Teil des Moonarch-Ökosystems.
|
|||||||
## Projektstruktur
|
## Projektstruktur
|
||||||
|
|
||||||
- `src/moongreet/` — Quellcode
|
- `src/moongreet/` — Quellcode
|
||||||
|
- `src/moongreet/data/` — Package-Assets (Default-Avatar, Icons) — werden mit dem Wheel ausgeliefert
|
||||||
- `tests/` — pytest Tests
|
- `tests/` — pytest Tests
|
||||||
- `data/` — Assets (Icons, Default-Avatar)
|
- `data/` — User-Assets (wallpaper.jpg) — nicht Teil des Packages
|
||||||
- `config/` — Konfigurationsdateien
|
- `config/` — Beispiel-Konfigurationsdateien für `/etc/moongreet/` und `/etc/greetd/`
|
||||||
|
|
||||||
## Kommandos
|
## Kommandos
|
||||||
|
|
||||||
|
|||||||
31
README.md
31
README.md
@ -23,17 +23,31 @@ Part of the Moonarch ecosystem.
|
|||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv pip install -e .
|
uv pip install .
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## System Setup
|
||||||
|
|
||||||
Configure greetd to use Moongreet:
|
1. Copy configuration:
|
||||||
|
```bash
|
||||||
|
sudo mkdir -p /etc/moongreet
|
||||||
|
sudo cp config/moongreet.toml /etc/moongreet/moongreet.toml
|
||||||
|
```
|
||||||
|
|
||||||
```ini
|
2. Edit `/etc/moongreet/moongreet.toml` — set an absolute path for the wallpaper.
|
||||||
[default_session]
|
|
||||||
command = "moongreet"
|
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
|
## Development
|
||||||
|
|
||||||
@ -43,6 +57,9 @@ uv run pytest tests/ -v
|
|||||||
|
|
||||||
# Type checking
|
# Type checking
|
||||||
uv run pyright src/
|
uv run pyright src/
|
||||||
|
|
||||||
|
# Run locally (without greetd)
|
||||||
|
uv run moongreet
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|||||||
9
config/greetd.conf
Normal file
9
config/greetd.conf
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# ABOUTME: Example greetd configuration for Moongreet.
|
||||||
|
# ABOUTME: Copy to /etc/greetd/config.toml and adjust as needed.
|
||||||
|
|
||||||
|
[terminal]
|
||||||
|
vt = 1
|
||||||
|
|
||||||
|
[default_session]
|
||||||
|
command = "moongreet"
|
||||||
|
user = "greeter"
|
||||||
@ -1,8 +1,9 @@
|
|||||||
# ABOUTME: Optional configuration for the Moongreet greeter.
|
# ABOUTME: Example configuration for the Moongreet greeter.
|
||||||
# ABOUTME: Background image and other visual settings.
|
# ABOUTME: Copy to /etc/moongreet/moongreet.toml and adjust paths.
|
||||||
|
|
||||||
[appearance]
|
[appearance]
|
||||||
background = "../data/wallpaper.jpg"
|
# Absolute path to wallpaper image
|
||||||
|
background = "/usr/share/backgrounds/wallpaper.jpg"
|
||||||
|
|
||||||
[behavior]
|
[behavior]
|
||||||
# show_user_list = true
|
# show_user_list = true
|
||||||
|
|||||||
42
pkg/PKGBUILD
Normal file
42
pkg/PKGBUILD
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# ABOUTME: AUR PKGBUILD for Moongreet — greetd greeter for Wayland.
|
||||||
|
# ABOUTME: Builds from local source, installs config and cache directory.
|
||||||
|
|
||||||
|
# Maintainer: Dominik Kressler
|
||||||
|
|
||||||
|
pkgname=moongreet
|
||||||
|
pkgver=0.1.0
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="A greetd greeter for Wayland, built with Python + GTK4 + gtk4-layer-shell"
|
||||||
|
arch=('any')
|
||||||
|
license=('MIT')
|
||||||
|
depends=(
|
||||||
|
'python'
|
||||||
|
'python-gobject'
|
||||||
|
'gtk4'
|
||||||
|
'gtk4-layer-shell'
|
||||||
|
'greetd'
|
||||||
|
)
|
||||||
|
makedepends=(
|
||||||
|
'python-build'
|
||||||
|
'python-installer'
|
||||||
|
'python-hatchling'
|
||||||
|
)
|
||||||
|
install=moongreet.install
|
||||||
|
source=("$pkgname-$pkgver.tar.gz")
|
||||||
|
sha256sums=('SKIP')
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "$srcdir/$pkgname-$pkgver"
|
||||||
|
python -m build --wheel --no-isolation
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "$srcdir/$pkgname-$pkgver"
|
||||||
|
python -m installer --destdir="$pkgdir" dist/*.whl
|
||||||
|
|
||||||
|
# Example config
|
||||||
|
install -Dm644 config/moongreet.toml "$pkgdir/etc/moongreet/moongreet.toml"
|
||||||
|
|
||||||
|
# Cache directory
|
||||||
|
install -dm755 "$pkgdir/var/cache/moongreet"
|
||||||
|
}
|
||||||
18
pkg/moongreet.install
Normal file
18
pkg/moongreet.install
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# ABOUTME: pacman install hooks for Moongreet.
|
||||||
|
# ABOUTME: Sets ownership on cache directory for the greeter user.
|
||||||
|
|
||||||
|
post_install() {
|
||||||
|
if getent passwd greeter > /dev/null 2>&1; then
|
||||||
|
chown greeter:greeter /var/cache/moongreet
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "==> Copy /etc/moongreet/moongreet.toml and adjust the wallpaper path."
|
||||||
|
echo "==> Configure greetd to use moongreet:"
|
||||||
|
echo " [default_session]"
|
||||||
|
echo " command = \"moongreet\""
|
||||||
|
echo " user = \"greeter\""
|
||||||
|
}
|
||||||
|
|
||||||
|
post_upgrade() {
|
||||||
|
post_install
|
||||||
|
}
|
||||||
@ -7,7 +7,6 @@ from pathlib import Path
|
|||||||
|
|
||||||
DEFAULT_CONFIG_PATHS = [
|
DEFAULT_CONFIG_PATHS = [
|
||||||
Path("/etc/moongreet/moongreet.toml"),
|
Path("/etc/moongreet/moongreet.toml"),
|
||||||
Path(__file__).parent.parent.parent / "config" / "moongreet.toml",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
|
from importlib.resources import files
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
@ -17,7 +18,8 @@ from moongreet.sessions import Session, get_sessions
|
|||||||
from moongreet.power import reboot, shutdown
|
from moongreet.power import reboot, shutdown
|
||||||
|
|
||||||
LAST_USER_PATH = Path("/var/cache/moongreet/last-user")
|
LAST_USER_PATH = Path("/var/cache/moongreet/last-user")
|
||||||
DEFAULT_AVATAR_PATH = Path(__file__).parent.parent.parent / "data" / "default-avatar.svg"
|
PACKAGE_DATA = files("moongreet") / "data"
|
||||||
|
DEFAULT_AVATAR_PATH = PACKAGE_DATA / "default-avatar.svg"
|
||||||
AVATAR_SIZE = 128
|
AVATAR_SIZE = 128
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
# ABOUTME: Handles CLI invocation and initializes the greeter window.
|
# ABOUTME: Handles CLI invocation and initializes the greeter window.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
from importlib.resources import files
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
gi.require_version("Gtk", "4.0")
|
gi.require_version("Gtk", "4.0")
|
||||||
@ -38,16 +38,16 @@ class MoongreetApp(Gtk.Application):
|
|||||||
window.present()
|
window.present()
|
||||||
|
|
||||||
def _register_icons(self) -> None:
|
def _register_icons(self) -> None:
|
||||||
"""Register custom icons from the data/icons directory."""
|
"""Register custom icons from the package data/icons directory."""
|
||||||
icons_dir = os.path.join(os.path.dirname(__file__), "..", "..", "data", "icons")
|
icons_dir = files("moongreet") / "data" / "icons"
|
||||||
icon_theme = Gtk.IconTheme.get_for_display(Gdk.Display.get_default())
|
icon_theme = Gtk.IconTheme.get_for_display(Gdk.Display.get_default())
|
||||||
icon_theme.add_search_path(os.path.realpath(icons_dir))
|
icon_theme.add_search_path(str(icons_dir))
|
||||||
|
|
||||||
def _load_css(self) -> None:
|
def _load_css(self) -> None:
|
||||||
"""Load the CSS stylesheet for the greeter."""
|
"""Load the CSS stylesheet for the greeter."""
|
||||||
css_provider = Gtk.CssProvider()
|
css_provider = Gtk.CssProvider()
|
||||||
css_path = os.path.join(os.path.dirname(__file__), "style.css")
|
css_path = files("moongreet") / "style.css"
|
||||||
css_provider.load_from_path(css_path)
|
css_provider.load_from_path(str(css_path))
|
||||||
Gtk.StyleContext.add_provider_for_display(
|
Gtk.StyleContext.add_provider_for_display(
|
||||||
Gdk.Display.get_default(),
|
Gdk.Display.get_default(),
|
||||||
css_provider,
|
css_provider,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user