fedora-dotfiles-tui 1.1.0

Terminal UI for fedora-dotfiles — browse, toggle, backup, and restore Fedora + KDE dotfiles
# fedora-dotfiles

Backup and restore Fedora + KDE Plasma dotfiles via GitHub — with per-file granularity.

- **`fedora-dotfiles`** — Python CLI (stdlib only) for backup/restore/git
- **`fedora-dotfiles-tui`** — Rust TUI (ratatui + crossterm) for interactive management

Tracks **74 files** across 3 categories. Every file can be individually toggled.

---

## Install & Quick Start

> **Prerequisite:** The TUI is a Rust binary; you need the Rust toolchain to compile it.
> Install Rust via [rustup]https://rustup.rs/ or your distro's package manager:

| Distro | Command |
|--------|---------|
| Fedora | `sudo dnf install rust cargo` |
| Arch / CachyOS | `sudo pacman -S rustup` |
| openSUSE | `sudo zypper install rust cargo` |
| Debian / Ubuntu | `sudo apt install rustc cargo` |
| Generic (rustup) | `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \| sh` |

---

**1. Install (recommended)**

```bash
cargo install fedora-dotfiles-tui
```

**2. Run the wizard**

```bash
fedora-dotfiles-tui --wizard
```

The wizard handles GitHub auth, repo setup, and offers an immediate backup.

Already set up?
```bash
fedora-dotfiles-tui              # TUI
fedora-dotfiles backup          # CLI backup
fedora-dotfiles restore         # CLI restore
```

---

## The TUI

Keyboard-driven, single binary, zero runtime deps.

| Key | Action |
|-----|--------|
| `` `` `j` `k` | Navigate |
| `Space` / `Enter` | Toggle file |
| `1``3` | Jump to category |
| `Tab` / `Shift+Tab` | Next/prev category |
| `!` `@` `#` | Batch toggle category |
| `/` | Filter (`Esc` to clear) |
| `b` | Backup (with spinner) |
| `r` | Restore all |
| `R` | Restore selected file |
| `d` | Diff file vs repo |
| `h` | Help |
| `q` | Quit |

**Color legend:** 🟢 enabled · 🔴 disabled · 🟡 needs sudo · 🟣 security-sensitive

**Status bar:** `[clean]` / `[3Δ]` (3 changed files) / `[no repo]`

---

## The Python CLI

Single-file, stdlib only. All ops available from the command line.

| Command | Description |
|---------|-------------|
| `init [--repo URL]` | Create config + manifest, clone GitHub repo |
| `backup` | Copy enabled files → commit → push |
| `restore [--dry-run] [--yes]` | Pull → backup existing → write to system |
| `list [--category X]` | Show tracked files with status |
| `enable <path>` / `disable <path>` | Toggle file tracking (fuzzy match) |
| `diff [path]` | Diff system vs repo |
| `status` | Git status of local repo |
| `pkglist export\|import` | Export/import installed packages (DNF) |

---

## What's Tracked

**74 files** across 3 categories:

- **System (10):** dnf config, dracut initramfs, locale, vconsole, environment, hostname, SDDM, GRUB2, SELinux, sysconfig/desktop
- **KDE Plasma 6 (47):** kdeglobals, kwinrc, kwinoutputconfig, kwinrulesrc, kscreenlockerrc, kglobalshortcutsrc, krunnerrc, plasmarc, plasmashellrc, plasma applets, dolphinrc, konsolerc, katerc, GTK bridges, and more
- **User (17):** shell (bash, fish), terminals (kitty, alacritty, ghostty), editors (nvim + LazyVim, micro), gitconfig, fontconfig, btop, SSH (disabled), and more

Disabled by default: KWallet, KDE Connect, SSH keys/hosts, Bluetooth.

---

## How It Works

**Backup:** read manifest → filter enabled → copy files to git repo → export package list → commit + push

**Restore:** pull from GitHub → backup existing files → write from repo (sudo for /etc) → offer package install

**Security:** `~/.ssh/`, `kwalletrc`, and `kdeconnect/` are disabled by default. Review with `list` before first backup.

---

## File Locations

| Item | Path |
|------|------|
| TUI binary | `~/.cargo/bin/fedora-dotfiles-tui` |
| Config | `~/.config/fedora-dotfiles/config.json` |
| Manifest | `~/.config/fedora-dotfiles/manifest.json` |
| Local git repo | `~/.local/share/fedora-dotfiles/repo/` |
| Restore backups | `~/.config/fedora-dotfiles/backups/<timestamp>/` |

## Requirements

- **Python CLI:** Python 3.8+, `git`, `dnf` (Fedora/RHEL), `gh` CLI (HTTPS auth)
- **Rust TUI:** Rust toolchain ([rustup]https://rustup.rs), installed via `cargo install`
- **Fedora-specific:** SELinux policy tools recommended for SELinux config restore

---

## Tips

- Restart Plasma after restoring KDE configs: `systemctl --user restart plasma-plasmashell`
- Monitor layout (`kwinoutputconfig.json`) has display UUIDs — KWin usually handles this across installs
- Backup before system updates: press `b` in the TUI or `./fedora-dotfiles backup`
- Automate: `0 20 * * * cd ~/FedoraOS.f && ./fedora-dotfiles backup`
- No sudo needed for backup — system files are world-readable. Only restore needs sudo.
- SELinux config restore: run `restorecon -Rv /etc/selinux` after restoring if needed

---

## Troubleshooting

| Symptom | Fix |
|---------|-----|
| "Manifest not found" | Run `fedora-dotfiles-tui --wizard` |
| TUI can't find CLI | Run from project root (`~/FedoraOS.f/`) |
| TUI doesn't start | Terminal ≥ 24 rows; try `export TERM=xterm-256color` |
| Permission denied (publickey) | Use HTTPS: `gh auth login` |
| Restore asks for password | Check terminal behind the TUI — system files need sudo |
| DNF package import fails | Some packages may need RPM Fusion; enable it first |