## Context

In GOverlay, MangoHud options are saved via `SaveMangoHudConfigCore` in `overlay_config.pas` which writes directly to `Settings.MangoHudCfgFile`. When a game profile is active, `Settings.MangoHudCfgFile` points to `/home/user/.config/goverlay/<game>/MangoHud.conf`.

Currently, `SaveMangoHudConfigCore` does not output the `blacklist=` directive. Instead, `overlayunit.pas` runs a post-save block that explicitly targets `GlobalMangoHudFile` (`~/.config/MangoHud/MangoHud.conf`). Because MangoHud only reads the file passed via `MANGOHUD_CONFIGFILE` when executing game profiles, the per-game `MangoHud.conf` lacks the blacklist line. Additionally, the existing block in `overlayunit.pas` uses `if not BlacklistCfg.HasKey('blacklist=')`, preventing updates when blacklist apps are added or removed.

## Goals / Non-Goals

**Goals:**
- Include `blacklist=` in `SaveMangoHudConfigCore` in `overlay_config.pas` so that both global and per-game MangoHud config files generated by GOverlay automatically receive the blacklist.
- Ensure updated blacklisted apps overwrite previous `blacklist=` values in config files upon saving.
- Retain backwards compatibility for global MangoHud configuration.

**Non-Goals:**
- Modifying how MangoHud itself processes the blacklist parameter.
- Changing the storage format of `~/.config/goverlay/blacklist.conf`.

## Decisions

1. **Move Blacklist Formatting into `SaveMangoHudConfigCore`**:
   - *Rationale*: `SaveMangoHudConfigCore` is the single source of truth for creating and saving `Settings.MangoHudCfgFile`. By reading `~/.config/goverlay/blacklist.conf` inside `SaveMangoHudConfigCore` and formatting `blacklist=app1,app2,...`, any active profile (game or global) will automatically have the blacklist appended to its output lines.
   - *Alternatives Considered*: Copying the blacklist post-save in `overlayunit.pas` for per-game paths. Rejected because duplicating logic in `overlayunit.pas` creates maintenance overhead.

2. **Update/Overwrite Existing `blacklist=` Keys using `TConfigFile` or Direct Line Replacement**:
   - *Rationale*: `TConfigFile` / `ConfigLines` will replace any pre-existing `blacklist=` line when saving, ensuring modifications in the Blacklist dialog update the active configuration files immediately.

## Risks / Trade-offs

- **[Risk]** If `blacklist.conf` is missing or empty, writing `blacklist=` could be empty.
  - *Mitigation*: Ensure `SaveMangoHudConfigCore` loads default stock blacklist items if `blacklist.conf` does not exist (matching existing initialization logic: `pamac-manager`, `lact`, `ghb`, `bitwig-studio`, `ptyxis`, `yumex`, `zenity`, etc.). Only write `blacklist=...` when at least one app is present.
