Files
aero3/scripts/07-aero-theme.sh
T

125 lines
5.0 KiB
Bash
Raw Normal View History

2026-06-19 10:02:12 -04:00
#!/usr/bin/env bash
# scripts/07-aero-theme.sh — Frutiger Aero wallpaper, subtle lofi service,
# glassmorphism theme, session launcher, autologin to the home screen.
source "$(dirname "${BASH_SOURCE[0]}")/lib/common.sh"
require_root
LFS="$AEROS_ROOT"
trap 'umount_vkfs 2>/dev/null || true' EXIT
# ---------------------------------------------------------------- wallpaper
make_wallpaper() {
step "Wallpaper (Frutiger Aero)"
local dst="$LFS/usr/share/backgrounds/aeros"
install -d "$dst"
local svg="$AEROS_TOP/assets/wallpaper/frutiger-aero.svg"
local png="$dst/frutiger-aero.png"
if command -v rsvg-convert >/dev/null 2>&1; then
rsvg-convert -w 1920 -h 1080 "$svg" -o "$png" && ok "rasterized SVG via rsvg-convert"
elif command -v inkscape >/dev/null 2>&1; then
inkscape "$svg" --export-type=png -w 1920 -h 1080 -o "$png" && ok "via inkscape"
elif command -v convert >/dev/null 2>&1; then
convert -background none -resize 1920x1080 "$svg" "$png" && ok "via ImageMagick"
else
warn "no SVG rasterizer found — using stdlib procedural generator"
python3 "$AEROS_TOP/assets/wallpaper/gen_wallpaper.py" "$png" 1920 1080
fi
# also keep the SVG source on the system
install -m644 "$svg" "$dst/frutiger-aero.svg"
ok "wallpaper installed -> /usr/share/backgrounds/aeros/frutiger-aero.png"
}
# ---------------------------------------------------------------- lofi
make_lofi() {
step "Subtle lofi loop"
local dst="$LFS/usr/share/aeros/lofi"
install -d "$dst"
if [[ ! -s "$dst/aero-lofi.wav" ]]; then
python3 "$AEROS_TOP/assets/lofi/generate_lofi.py" "$dst/aero-lofi.wav"
fi
install -m644 "$AEROS_TOP/assets/lofi/generate_lofi.py" "$dst/generate_lofi.py"
ok "lofi track -> /usr/share/aeros/lofi/aero-lofi.wav"
}
# ---------------------------------------------------------------- theme
make_theme() {
step "Glassmorphism theme (AeroGlass)"
install -d "$LFS/usr/share/themes/AeroGlass/gtk-4.0"
install -m644 "$AEROS_TOP/assets/theme/AeroGlass/gtk-4.0/gtk.css" \
"$LFS/usr/share/themes/AeroGlass/gtk-4.0/gtk.css"
install -d "$LFS/etc/gtk-4.0" "$LFS/etc/gtk-3.0"
install -m644 "$AEROS_TOP/assets/theme/settings.ini" "$LFS/etc/gtk-4.0/settings.ini"
install -m644 "$AEROS_TOP/assets/theme/settings.ini" "$LFS/etc/gtk-3.0/settings.ini"
# system-wide env so toolkits pick the theme + wayland
cat >> "$LFS/etc/environment" <<'EOF'
GTK_THEME=AeroGlass
QT_QPA_PLATFORM=wayland
MOZ_ENABLE_WAYLAND=1
XDG_CURRENT_DESKTOP=AeroOS
EOF
ok "AeroGlass theme installed"
}
# ---------------------------------------------------------------- session + services
make_session() {
step "Session launcher + services"
install -m755 "$AEROS_TOP/desktop/aero-session/aero-session" "$LFS/usr/bin/aero-session"
install -m755 "$AEROS_TOP/desktop/aero-lofi/aero-lofi" "$LFS/usr/bin/aero-lofi"
install -d "$LFS/usr/lib/systemd/user"
install -m644 "$AEROS_TOP/desktop/aero-lofi/aero-lofi.service" \
"$LFS/usr/lib/systemd/user/aero-lofi.service"
ok "session + lofi service installed"
}
# ---------------------------------------------------------------- users/autologin (chroot)
configure_users() {
step "Live user + autologin to the AeroOS home screen"
mount_vkfs
cat > "$LFS/root/setup-users.sh" <<INNER
#!/bin/bash
set -e
# groups a desktop user needs
for g in video input render seat audio wheel users; do getent group \$g >/dev/null || groupadd -r \$g 2>/dev/null || true; done
id ${AEROS_LIVE_USER} >/dev/null 2>&1 || useradd -m -G wheel,video,input,render,seat,audio,users -s /bin/bash ${AEROS_LIVE_USER}
echo "${AEROS_LIVE_USER}:${AEROS_LIVE_PASS}" | chpasswd
echo "root:${AEROS_ROOT_PASS}" | chpasswd
# autologin the live user on tty1
mkdir -p /etc/systemd/system/getty@tty1.service.d
cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf <<EOF
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin ${AEROS_LIVE_USER} --noclear %I \$TERM
EOF
# start the Aero session automatically on tty1 login
cat > /home/${AEROS_LIVE_USER}/.bash_profile <<'EOF'
# Launch the AeroOS glassmorphism desktop on the first VT, once.
if [ -z "\$WAYLAND_DISPLAY" ] && [ "\$(tty)" = "/dev/tty1" ]; then
exec aero-session
fi
EOF
chown ${AEROS_LIVE_USER}:${AEROS_LIVE_USER} /home/${AEROS_LIVE_USER}/.bash_profile
# enable lofi for the live user by default
loginctl enable-linger ${AEROS_LIVE_USER} 2>/dev/null || true
mkdir -p /home/${AEROS_LIVE_USER}/.config/systemd/user/default.target.wants
ln -sf /usr/lib/systemd/user/aero-lofi.service \
/home/${AEROS_LIVE_USER}/.config/systemd/user/default.target.wants/aero-lofi.service
chown -R ${AEROS_LIVE_USER}:${AEROS_LIVE_USER} /home/${AEROS_LIVE_USER}/.config
# seatd for the compositor's DRM/input session
systemctl enable seatd 2>/dev/null || true
echo "users + autologin configured"
INNER
chmod +x "$LFS/root/setup-users.sh"
in_chroot "AEROS_LIVE_USER='$AEROS_LIVE_USER' AEROS_LIVE_PASS='$AEROS_LIVE_PASS' AEROS_ROOT_PASS='$AEROS_ROOT_PASS' /root/setup-users.sh"
umount_vkfs
}
make_wallpaper
make_lofi
make_theme
make_session
configure_users
ok "Aero identity applied"