print_session_information() {
    cat <<'EOF'

    Select "Aqueous" from your display manager's Wayland session list.
    The session runs through uwsm, which manages the compositor lifecycle,
    exports the live Wayland/XWayland environment, starts graphical-session
    services, and stops them cleanly at logout. No Aqueous user unit needs to
    be enabled manually.

    User configuration lives in ~/.config/aqueous/. On first login, wm.toml
    and the inert outputs.toml template are copied there only when missing.
    Aqueous also supports separate layout.toml, input.toml, and rules.toml
    files and hot-reloads valid changes without restarting the compositor.

    Useful commands:
        aqueousctl windows
        aqueousctl outputs
        aqueousctl layout --output <name> --json

    Session log:
        $XDG_RUNTIME_DIR/aqueous-wm.log

    The optional noctalia-greeter is the recommended display-manager frontend.
    SDDM and other Wayland-capable display managers also work.
EOF

    if [ -e /usr/lib/systemd/user/noctalia.service ]; then
        cat <<'EOF'

    Noctalia starts automatically with the Aqueous graphical session. The
    packaged Aqueous Settings source is registered and enabled once per user;
    add its widget from Noctalia's bar widget picker. An intentional later
    disable is preserved.
EOF
    elif [ -e /usr/lib/systemd/user/aqueous-dms.service ]; then
        cat <<'EOF'

    DankMaterialShell starts automatically with the Aqueous graphical session.
    The packaged default configuration uses DMS Spotlight for the launcher
    action. No DMS user unit needs to be enabled manually.
EOF
    fi

    if command -v aqueous-welcome >/dev/null 2>&1; then
        cat <<'EOF'

    "Welcome to Aqueous" opens automatically once for new users and remains
    available as aqueous-welcome or from the application menu.
EOF
    fi
}

post_install() {
    printf '==> Aqueous %s installed.\n' "${1:-unknown}"
    print_session_information
}

post_upgrade() {
    printf '==> Aqueous upgraded from %s to %s.\n' "${2:-unknown}" "${1:-unknown}"
    cat <<'EOF'

    Restart the Aqueous session to load the new compositor, bundled wlroots,
    environment, and user units. Existing files in ~/.config/aqueous are not
    overwritten by the session launcher. Review any pacnew files created for
    system-wide configuration before merging them.

    If upgrading while logged in, refresh the user-unit cache first:
        systemctl --user daemon-reload
EOF
    print_session_information
}

post_remove() {
    cat <<'EOF'
==> Aqueous removed.

    Per-user configuration, cache, and state were retained:
        ~/.config/aqueous
        ~/.cache/aqueous
        ~/.local/state/aqueous

    Remove those directories manually if they are no longer wanted.
EOF
}
