- Implement [MainWindow] section stripping in backup and restore scripts to prevent screen geometry/monitor layout noise across devices - Add robust hostname detection and customizable archive naming in backup.sh - Add optional interactive git commit and push prompt upon successful backup - Update restore.sh diff preview and extraction to respect sanitized konsolerc - Add AGENTS.md documentation detailing script architecture and conventions
1.7 KiB
1.7 KiB
AGENTS.md
Overview
Lightweight Bash utility scripts for KDE Konsole configuration backup, cross-device synchronization, and restoration.
Key Features & Commands
-
Backup:
./backup.sh- Automatically strips device-specific screen geometry / monitor layouts (
[MainWindow]section inkonsolerc) to ensure clean cross-device sync. - Staged in
backups/with default naming format:konsole_backup_<hostname>_YYYYMMDD_HHMMSS.zip. - Prompts user to confirm or edit the backup archive filename before saving.
- Enforces a retention policy of max 10 backups (older ones deleted and removed via
git rmif inside a git repository). - Prompts to commit and push the new backup to git remote.
- Automatically strips device-specific screen geometry / monitor layouts (
-
Restore:
./restore.sh [optional_zip_path]- Supports positional arguments, stdin piping (
echo "file.zip" | ./restore.sh), and an interactive selection menu if no input is provided. - Sanitizes
konsolercto avoid overwriting the target machine's window/screen geometry. - Supports file-by-file diff preview (
[d]) usinggit diff --no-indexordiff. - Reads interactive prompts safely from
/dev/ttywhen stdin is redirected.
- Supports positional arguments, stdin piping (
Target Paths (Relative to $HOME)
.config/konsolerc(sanitized of[MainWindow]geometry).local/share/konsole(profiles, color schemes, bookmarks, keytabs).local/share/kxmlgui5/konsole(UI toolbars / actions).config/konsole.notifyrc.config/konsolesshconfig
Implementation Details & Conventions
- Shell: Pure Bash 4+ with
set -euo pipefail. - Safety: Uses
mktemp -dfor temporary staging directories withtrap ... EXITcleanup. - Verification: Run
bash -n backup.sh restore.shto check syntax.