From 28e21af2068c837d281d75f942ef08556d53de1c Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Mon, 6 Jul 2026 18:20:00 +0100 Subject: [PATCH] feat(system): menu parity for downstream options (slice 1) Added toggles for updates, battery limit, bluetooth, and printing to the Control Center. Wired default values to read from theme-state.json settings. Verified: V1. --- agent/JOURNAL.md | 7 +++ flake.nix | 4 +- modules/home/options.nix | 4 +- modules/nixos/options.nix | 6 +-- modules/nixos/services.nix | 2 +- .../nomarchy-control-center.sh | 43 ++++++++++++++++++- 6 files changed, 57 insertions(+), 9 deletions(-) diff --git a/agent/JOURNAL.md b/agent/JOURNAL.md index 7d6fc29..02c5b42 100644 --- a/agent/JOURNAL.md +++ b/agent/JOURNAL.md @@ -17,6 +17,13 @@ Template: --- +## 2026-07-06 — menu parity for downstream-flake options (iteration #51, slice 1) +- **Task:** PROPOSED item — ensure `nomarchy.*` options have a menu toggle where appropriate. +- **Did:** Audited options and implemented the first slice of missing toggles in the TUI Control Center (`Updates`, `Battery Limit`, `Bluetooth`, `Printing`). Wired `modules/home/options.nix` and `modules/nixos/options.nix` to use `config.nomarchy.settings.*` as defaults. +- **Verified:** V1 (flake check --no-build passed clean, evaluating successfully). +- **Pending:** user visual review and testing. +- **Next suggestion:** implement slice 2 (keyboard layouts and terminal picker) or triage other PROPOSED items. + ## 2026-07-06 — waybar redesign (iteration #50, one-off) - **Task:** User request — remove system usage (CPU) and memory items from waybar. - **Did:** removed `cpu` and `memory` from `modules-right` and the CSS styling blocks in `modules/home/waybar.nix`. diff --git a/flake.nix b/flake.nix index b7589ad..2dc72be 100644 --- a/flake.nix +++ b/flake.nix @@ -167,9 +167,9 @@ opts); surface = lib.concatLists [ (names "nomarchy." - ((import ./modules/home/options.nix { inherit lib pkgs; }).options.nomarchy)) + ((import ./modules/home/options.nix { inherit lib pkgs; config = { }; }).options.nomarchy)) (names "nomarchy.system." - ((import ./modules/nixos/options.nix { inherit lib; }).options.nomarchy.system)) + ((import ./modules/nixos/options.nix { inherit lib; config = { }; }).options.nomarchy.system)) (names "nomarchy.hardware." ((import ./modules/nixos/hardware.nix { inherit lib pkgs; config = { }; }).options.nomarchy.hardware)) (names "nomarchy.services." diff --git a/modules/home/options.nix b/modules/home/options.nix index be198dc..a47405a 100644 --- a/modules/home/options.nix +++ b/modules/home/options.nix @@ -1,6 +1,6 @@ # User-level `nomarchy.*` options — the full surface downstream users # configure in their home.nix. Kept small on purpose. -{ lib, pkgs, ... }: +{ config, lib, pkgs, ... }: let # One output's layout — turned into a Hyprland `monitor` rule in @@ -224,7 +224,7 @@ in against upstream and — when Flatpak is enabled — counts Flatpak updates, surfacing a Waybar indicator + a notification when something is available. It never changes anything; you still run sys-update / - home-update / flatpak update yourself''; + home-update / flatpak update yourself'' // { default = config.nomarchy.settings.updates.enable or false; }; interval = lib.mkOption { type = lib.types.str; diff --git a/modules/nixos/options.nix b/modules/nixos/options.nix index b5cada8..843a6c6 100644 --- a/modules/nixos/options.nix +++ b/modules/nixos/options.nix @@ -3,7 +3,7 @@ # Deliberately small: only things a downstream user plausibly disagrees # with get a toggle. Everything else in the system module is set with # lib.mkDefault, so plain NixOS options override it natively. -{ lib, ... }: +{ config, lib, ... }: { options.nomarchy.system = { @@ -44,7 +44,7 @@ option'' // { default = true; }; audio.enable = lib.mkEnableOption "the Pipewire audio stack" // { default = true; }; - bluetooth.enable = lib.mkEnableOption "Bluetooth support with blueman" // { default = true; }; + bluetooth.enable = lib.mkEnableOption "Bluetooth support with blueman" // { default = config.nomarchy.settings.bluetooth.enable or true; }; autoTimezone.enable = lib.mkEnableOption '' automatic timezone detection (geoclue + automatic-timezoned): the @@ -102,7 +102,7 @@ batteryChargeLimit = lib.mkOption { type = lib.types.nullOr (lib.types.ints.between 50 100); - default = null; + default = config.nomarchy.settings.power.batteryChargeLimit or null; example = 80; description = '' Stop charging at this percentage to extend battery lifespan, diff --git a/modules/nixos/services.nix b/modules/nixos/services.nix index 2a388a4..f37b362 100644 --- a/modules/nixos/services.nix +++ b/modules/nixos/services.nix @@ -77,7 +77,7 @@ in printing.enable = lib.mkEnableOption '' CUPS printing with Avahi/mDNS, so network printers are auto-discovered (add vendor drivers via `services.printing.drivers`); the menu's - System ▸ Printers entry opens the system-config-printer GUI''; + System ▸ Printers entry opens the system-config-printer GUI'' // { default = config.nomarchy.settings.printing.enable or false; }; openrgb.enable = lib.mkEnableOption '' the OpenRGB daemon and GUI for controlling RGB lighting on peripherals diff --git a/pkgs/nomarchy-control-center/nomarchy-control-center.sh b/pkgs/nomarchy-control-center/nomarchy-control-center.sh index 4f04537..46db500 100644 --- a/pkgs/nomarchy-control-center/nomarchy-control-center.sh +++ b/pkgs/nomarchy-control-center/nomarchy-control-center.sh @@ -122,7 +122,7 @@ function appearance_menu() { function toggles_menu() { while true; do - choice=$(gum choose "Auto-commit" "Auto-timezone" "Night Light" "Back") + choice=$(gum choose "Auto-commit" "Auto-timezone" "Night Light" "Updates" "Battery Limit" "Bluetooth" "Printing" "Back") case "$choice" in "Auto-commit") cur=$(get_state "settings.autoCommit") @@ -155,6 +155,47 @@ function toggles_menu() { 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 + ;; + "Battery Limit") + limit=$(gum input --prompt "Enter battery charge limit % (or empty for default): " --placeholder "$(get_state settings.power.batteryChargeLimit)") + if [ -n "$limit" ]; then + set_state "settings.power.batteryChargeLimit" "$limit" + else + set_state "settings.power.batteryChargeLimit" "null" + fi + ;; + "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 + ;; "Back"|*) break ;; esac done