Files
dotfiles/system/install-greeter.sh
mpuchstein 8b9c38ab48 hypr: unify lockscreen and login screen via hyprlogin
Replace nwg-hello with hyprlogin as the greetd greeter. Both hyprlock
and hyprlogin now share a single apex-neon theme fragment
(.chezmoitemplates/apex-neon-lock.conf), giving an identical look on
lock and login.

- Add system/ staging tree for /etc files (not auto-applied by chezmoi)
- Add system/install-greeter.sh to render templates and sudo-install to /etc
- Add apex-neon shared fragment: palette, font, animations, input-field,
  clock/date bubbles, weather/location bubbles
- Add dot_config/hypr/themes/apex-neon-lock.conf.tmpl ($HOME copy for hyprlock)
- Rewrite hyprlock.conf.tmpl to source the shared fragment; move
  notification bubble here (hyprlock-only, requires quickshell)
- Add Quickshell IpcHandler so `qs ipc call notifications count` works
- Session fixed to hyprland-uwsm.desktop; greetd config targets greetd.conf
2026-05-29 17:19:32 +02:00

114 lines
3.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Install hyprlogin + greetd config from chezmoi-tracked sources into /etc.
# Run manually after `chezmoi apply` when files under system/ change.
#
# Usage: ~/.local/share/chezmoi/system/install-greeter.sh [--dry-run]
set -euo pipefail
dry_run=0
[[ "${1:-}" == "--dry-run" ]] && dry_run=1
source_dir="${CHEZMOI_SOURCE_DIR:-}"
if [[ -z "$source_dir" ]] && command -v chezmoi >/dev/null 2>&1; then
source_dir="$(chezmoi source-path 2>/dev/null || true)"
fi
[[ -z "$source_dir" ]] && source_dir="$HOME/.local/share/chezmoi"
sys_dir="$source_dir/system"
if [[ ! -d "$sys_dir" ]]; then
echo "no system/ tree in $source_dir" >&2
exit 1
fi
staging="$(mktemp -d -t greeter-staging-XXXXXX)"
trap 'rm -rf "$staging"' EXIT
# Files to install: source.tmpl → /etc target (mode)
files=(
"etc/greetd/greetd.conf.tmpl /etc/greetd/greetd.conf 0644"
"etc/hyprlogin/apex-neon.conf.tmpl /etc/hyprlogin/apex-neon.conf 0644"
"etc/hyprlogin/hyprlogin.conf.tmpl /etc/hyprlogin/hyprlogin.conf 0644"
"etc/hyprlogin/hyprland-greeter.conf.tmpl /etc/hyprlogin/hyprland-greeter.conf 0644"
)
render() {
local src="$1" dst="$2"
mkdir -p "$(dirname "$dst")"
chezmoi execute-template --source "$source_dir" < "$src" > "$dst"
}
needs_install=0
declare -a plan
for entry in "${files[@]}"; do
read -r rel target mode <<<"$entry"
src="$sys_dir/$rel"
rendered="$staging/$rel"
rendered="${rendered%.tmpl}"
render "$src" "$rendered"
if [[ ! -f "$target" ]] || ! diff -q "$rendered" "$target" >/dev/null 2>&1; then
plan+=("$rendered$target ($mode)")
needs_install=1
fi
done
# Wallpapers: per-monitor, driven by chezmoi data.monitors[].lockscreen-wallpaper
# Renders a "name|path" line per monitor that has a wallpaper set.
wp_tmpl='{{ range .monitors }}{{ $wp := index . "lockscreen-wallpaper" }}{{ if $wp }}{{ .name }}|{{ $wp }}
{{ end }}{{ end }}'
declare -a wp_plan
while IFS='|' read -r mon wp; do
[[ -z "$mon" || -z "$wp" ]] && continue
wp="${wp/#\~/$HOME}"
if [[ ! -f "$wp" ]]; then
echo "warning: monitor $mon wallpaper missing: $wp" >&2
continue
fi
ext="${wp##*.}"
target="/etc/hyprlogin/wallpaper-${mon}.${ext}"
if [[ ! -f "$target" ]] || ! cmp -s "$wp" "$target"; then
plan+=("$wp$target (0644)")
wp_plan+=("$wp|$target")
needs_install=1
fi
done < <(chezmoi execute-template --source "$source_dir" <<<"$wp_tmpl")
if (( ! needs_install )); then
echo "nothing to do — /etc files already match chezmoi source"
exit 0
fi
echo "would install:"
printf ' %s\n' "${plan[@]}"
if (( dry_run )); then
exit 0
fi
# Back up current greetd config once, the first time, for one-step rollback.
if [[ -f /etc/greetd/greetd.conf && ! -f /etc/greetd/greetd.conf.nwg-hello-bak ]]; then
echo "backing up existing /etc/greetd/greetd.conf → /etc/greetd/greetd.conf.nwg-hello-bak"
sudo cp -a /etc/greetd/greetd.conf /etc/greetd/greetd.conf.nwg-hello-bak
fi
for entry in "${files[@]}"; do
read -r rel target mode <<<"$entry"
rendered="$staging/${rel%.tmpl}"
sudo install -Dm"$mode" "$rendered" "$target"
done
for pair in "${wp_plan[@]:-}"; do
[[ -z "$pair" ]] && continue
IFS='|' read -r src target <<<"$pair"
sudo install -Dm0644 "$src" "$target"
done
cat <<EOF
done. to apply on the running system (do this from a spare TTY — Ctrl+Alt+F3 — so you don't lock yourself out):
sudo systemctl restart greetd
rollback:
sudo cp /etc/greetd/greetd.conf.nwg-hello-bak /etc/greetd/greetd.conf && sudo systemctl restart greetd
EOF