feat(menu): Recovery scopes (#111), System IA (#105), drop Control Center (#110)
Some checks failed
Check / eval (push) Has been cancelled
Some checks failed
Check / eval (push) Has been cancelled
System is Connectivity / Devices / Recovery / Preferences under the same six-entry root. Recovery lists desktop (HM), system boot, and BTRFS files once each with cost labels. Control Center is gone: blur/gaps live in Look & Feel; update checks and Bluetooth/Printing package toggles in Preferences (with rebuilds). docs/RECOVERY paths updated.
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
{ writeShellApplication, coreutils, gawk, jq, gum }:
|
||||
|
||||
writeShellApplication {
|
||||
name = "nomarchy-control-center";
|
||||
runtimeInputs = [ coreutils gawk jq gum ];
|
||||
text = builtins.readFile ./nomarchy-control-center.sh;
|
||||
}
|
||||
@@ -1,246 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Nomarchy Control Center — TUI frontend over nomarchy-state-sync and tools
|
||||
# Uses charmbracelet/gum for rendering.
|
||||
|
||||
trap 'exit 0' SIGINT
|
||||
|
||||
function get_state() {
|
||||
nomarchy-state-sync get "$1" 2>/dev/null || echo ""
|
||||
}
|
||||
|
||||
function set_state() {
|
||||
nomarchy-state-sync --quiet set "$1" "$2" --no-switch
|
||||
}
|
||||
|
||||
function first_boot() {
|
||||
gum style --border normal --margin "1" --padding "1 2" --border-foreground 212 "Welcome to Nomarchy!"
|
||||
|
||||
echo "Pick a Theme Preset:"
|
||||
themes=$(nomarchy-state-sync list)
|
||||
chosen_theme=$(printf "%s" "$themes" | gum choose)
|
||||
if [ -n "$chosen_theme" ]; then
|
||||
echo "Applying theme $chosen_theme..."
|
||||
nomarchy-state-sync apply "$chosen_theme"
|
||||
fi
|
||||
|
||||
if gum confirm "Enable auto-commit for your config? (settings changes + a sweep of pending edits before each rebuild)"; then
|
||||
set_state "settings.autoCommit" "true"
|
||||
else
|
||||
set_state "settings.autoCommit" "false"
|
||||
fi
|
||||
|
||||
if command -v nomarchy-autotimezone >/dev/null 2>&1; then
|
||||
if gum confirm "Enable automatic timezone detection?"; then
|
||||
set_state "settings.autoTimezone" "true"
|
||||
else
|
||||
set_state "settings.autoTimezone" "false"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Post-install hardware/day-2 tips (#43 Firmware; #73 fingerprint +
|
||||
# doctor). Self-gated on the same CLI presence the System menu uses;
|
||||
# first-boot is once, so no dismiss state file is needed.
|
||||
if command -v fwupdmgr >/dev/null 2>&1; then
|
||||
gum style --foreground 245 \
|
||||
"Tip: SUPER+M → System › Firmware checks LVFS updates (never auto-flashes)."
|
||||
fi
|
||||
if command -v fprintd-list >/dev/null 2>&1; then
|
||||
gum style --foreground 245 \
|
||||
"Tip: SUPER+M → System › Fingerprint to enroll a finger (or fprintd-enroll)."
|
||||
fi
|
||||
if command -v nomarchy-doctor >/dev/null 2>&1; then
|
||||
gum style --foreground 245 \
|
||||
"Tip: run nomarchy-doctor (or SUPER+M → System › Doctor) for a read-only health check."
|
||||
fi
|
||||
|
||||
gum style --foreground 212 "First boot configuration complete!"
|
||||
echo "You can always change these later in the Control Center."
|
||||
read -r -n 1 -s -p "Press any key to exit..."
|
||||
echo
|
||||
}
|
||||
|
||||
function main_menu() {
|
||||
while true; do
|
||||
choice=$(gum choose "Appearance" "System Toggles" "Health (Doctor)" "Rollback" "Exit")
|
||||
case "$choice" in
|
||||
"Appearance") appearance_menu ;;
|
||||
"System Toggles") toggles_menu ;;
|
||||
"Health (Doctor)")
|
||||
if command -v nomarchy-doctor >/dev/null 2>&1; then
|
||||
nomarchy-doctor || true
|
||||
else
|
||||
echo "nomarchy-doctor not found."
|
||||
fi
|
||||
echo
|
||||
read -r -n 1 -s -p "Press any key to return..."
|
||||
echo
|
||||
;;
|
||||
"Rollback")
|
||||
gens=$(home-manager generations 2>/dev/null | head -10)
|
||||
if [ -z "$gens" ]; then
|
||||
echo "No Home Manager generations found."
|
||||
else
|
||||
tmp=$(mktemp)
|
||||
printf "%s\n" "$gens" | awk '{ printf "Desktop gen %s — %s %s%s\n", $5, $1, $2, (NR==1 ? " (current)" : "") }' > "$tmp"
|
||||
sel=$(gum choose < "$tmp" || true)
|
||||
rm -f "$tmp"
|
||||
if [ -n "$sel" ]; then
|
||||
num=${sel#Desktop gen }
|
||||
num=${num%% *}
|
||||
path=$(printf "%s\n" "$gens" | awk -v n="$num" '$5 == n { print $7 }')
|
||||
if [ -x "$path/activate" ]; then
|
||||
echo "Activating Home Manager generation $num..."
|
||||
"$path/activate"
|
||||
echo "Desktop rolled back to generation $num."
|
||||
else
|
||||
echo "Generation $num not found."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo
|
||||
read -r -n 1 -s -p "Press any key to return..."
|
||||
echo
|
||||
;;
|
||||
"Exit"|*) break ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function appearance_menu() {
|
||||
while true; do
|
||||
choice=$(gum choose "Pick Theme" "Toggle Blur" "Set Gaps" "Back")
|
||||
case "$choice" in
|
||||
"Pick Theme")
|
||||
themes=$(nomarchy-state-sync list)
|
||||
chosen=$(printf "%s" "$themes" | gum choose)
|
||||
if [ -n "$chosen" ]; then
|
||||
nomarchy-state-sync apply "$chosen"
|
||||
fi
|
||||
;;
|
||||
"Toggle Blur")
|
||||
blur=$(get_state "ui.blur")
|
||||
if [ "$blur" = "true" ]; then
|
||||
set_state "ui.blur" "false"
|
||||
else
|
||||
set_state "ui.blur" "true"
|
||||
fi
|
||||
echo "Blur setting saved (requires rebuild)."
|
||||
sleep 1
|
||||
;;
|
||||
"Set Gaps")
|
||||
gaps=$(gum input --prompt "Enter gaps in pixels: " --placeholder "$(get_state ui.gapsOut)")
|
||||
if [ -n "$gaps" ]; then
|
||||
set_state "ui.gapsOut" "$gaps"
|
||||
echo "Gaps set to $gaps (requires rebuild)."
|
||||
sleep 1
|
||||
fi
|
||||
;;
|
||||
"Back"|*) break ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function toggles_menu() {
|
||||
while true; do
|
||||
choice=$(gum choose "Auto-commit" "Auto-timezone" "Night Light" "Updates" "Bluetooth" "Printing" "Terminal" "Keyboard Layout" "Auto-Login" "Back")
|
||||
case "$choice" in
|
||||
"Auto-commit")
|
||||
cur=$(get_state "settings.autoCommit")
|
||||
if [ "$cur" = "true" ]; then
|
||||
set_state "settings.autoCommit" "false"
|
||||
echo "Auto-commit disabled."
|
||||
else
|
||||
set_state "settings.autoCommit" "true"
|
||||
echo "Auto-commit enabled."
|
||||
fi
|
||||
sleep 1
|
||||
;;
|
||||
"Auto-timezone")
|
||||
cur=$(get_state "settings.autoTimezone")
|
||||
if [ "$cur" = "true" ]; then
|
||||
set_state "settings.autoTimezone" "false"
|
||||
echo "Auto-timezone disabled."
|
||||
else
|
||||
set_state "settings.autoTimezone" "true"
|
||||
echo "Auto-timezone enabled."
|
||||
fi
|
||||
sleep 1
|
||||
;;
|
||||
"Night Light")
|
||||
if command -v nomarchy-nightlight >/dev/null 2>&1; then
|
||||
nomarchy-nightlight toggle
|
||||
sleep 1
|
||||
else
|
||||
echo "nomarchy-nightlight not found."
|
||||
sleep 1
|
||||
fi
|
||||
;;
|
||||
"Updates")
|
||||
cur=$(get_state "settings.updates.enable")
|
||||
if [ "$cur" = "true" ]; then
|
||||
set_state "settings.updates.enable" "false"
|
||||
echo "Updates checker disabled (requires rebuild)."
|
||||
else
|
||||
set_state "settings.updates.enable" "true"
|
||||
echo "Updates checker enabled (requires rebuild)."
|
||||
fi
|
||||
sleep 1
|
||||
;;
|
||||
"Bluetooth")
|
||||
cur=$(get_state "settings.bluetooth.enable")
|
||||
if [ "$cur" = "true" ]; then
|
||||
set_state "settings.bluetooth.enable" "false"
|
||||
echo "Bluetooth disabled (requires rebuild)."
|
||||
else
|
||||
set_state "settings.bluetooth.enable" "true"
|
||||
echo "Bluetooth enabled (requires rebuild)."
|
||||
fi
|
||||
sleep 1
|
||||
;;
|
||||
"Printing")
|
||||
cur=$(get_state "settings.printing.enable")
|
||||
if [ "$cur" = "true" ]; then
|
||||
set_state "settings.printing.enable" "false"
|
||||
echo "Printing services disabled (requires rebuild)."
|
||||
else
|
||||
set_state "settings.printing.enable" "true"
|
||||
echo "Printing services enabled (requires rebuild)."
|
||||
fi
|
||||
sleep 1
|
||||
;;
|
||||
"Terminal")
|
||||
echo "Kitty is Nomarchy's terminal (themed from theme-state)."
|
||||
echo "Override nomarchy.terminal in home.nix only if you install another yourself."
|
||||
sleep 2
|
||||
;;
|
||||
"Keyboard Layout")
|
||||
layout=$(gum input --prompt "Enter keyboard layout (e.g. us, de, es): " --placeholder "$(get_state settings.keyboard.layout | tr -d '"')")
|
||||
if [ -n "$layout" ]; then
|
||||
set_state "settings.keyboard.layout" "\"$layout\""
|
||||
echo "Keyboard layout set to $layout (requires rebuild)."
|
||||
fi
|
||||
sleep 1
|
||||
;;
|
||||
"Auto-Login")
|
||||
user=$(gum input --prompt "Enter auto-login username (or empty to disable): " --placeholder "$(get_state settings.greeter.autoLogin | tr -d '"')")
|
||||
if [ -n "$user" ]; then
|
||||
set_state "settings.greeter.autoLogin" "\"$user\""
|
||||
echo "Auto-login set to $user (requires rebuild)."
|
||||
else
|
||||
set_state "settings.greeter.autoLogin" "null"
|
||||
echo "Auto-login disabled (requires rebuild)."
|
||||
fi
|
||||
sleep 1
|
||||
;;
|
||||
"Back"|*) break ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
if [ "${1:-}" = "--first-boot" ]; then
|
||||
first_boot
|
||||
else
|
||||
main_menu
|
||||
fi
|
||||
Reference in New Issue
Block a user