From c2f90c7d0a764ac0966fc38614eb553f2395ddda Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Sat, 20 Jun 2026 20:09:35 +0100 Subject: [PATCH] =?UTF-8?q?feat(menu):=20printer=20setup=20=E2=80=94=20sys?= =?UTF-8?q?tem-config-printer=20in=20the=20System=20submenu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A `nomarchy-menu printers` entry opens system-config-printer (the CUPS admin GUI), mirroring the bluetooth/blueman pattern: the printing service ships the package via environment.systemPackages and the menu execs it, self-gated on the system-config-printer binary so the entry appears only when nomarchy.services.printing is on. No direct keybind (rare one-off). Co-Authored-By: Claude Opus 4.8 --- docs/ROADMAP.md | 12 ++++++++++++ modules/home/rofi.nix | 12 +++++++++++- modules/nixos/services.nix | 6 +++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 4584032..0c027af 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -85,6 +85,18 @@ how to override it. Items marked ✓ are shipped. so it'd mean adopting a new secret manager. Revisit if that changes. - Also: menu search is now **case-insensitive fuzzy** (`matching = fuzzy`, `sorting-method = fzf`) across every module + the launcher. +- ✓ **Printer setup menu module:** a `nomarchy-menu printers` entry in the + **System** submenu opens **system-config-printer** (the CUPS admin GUI — + discovery, drivers/PPDs, options, test page), mirroring the bluetooth/blueman + pattern: the printing service ships the package (`environment.systemPackages`) + and the menu execs it, self-gated on the `system-config-printer` binary so + the entry appears only when `nomarchy.services.printing` is on. No direct + `SUPER+CTRL` bind — printer setup is a rare one-off, not a frequent utility + (left out deliberately; easy to add). Chose the GUI over a rofi-native + `lpadmin` flow (driver/PPD picking is impractical in rofi) and the CUPS web + UI (an unthemed browser page). Validated: the generated menu script's + `bash -n` build check passes, and an eval confirms printing-on puts + system-config-printer in `systemPackages`. Pending an on-machine check. - **Theme parity with legacy:** summer-day/night now carry their legacy bar layouts as `waybar.jsonc` whole-swaps (adapted: dead legacy script modules dropped, Nerd-Fonts-v2 codepoints remapped to FontAwesome/v3, diff --git a/modules/home/rofi.nix b/modules/home/rofi.nix index 0100ac3..86f004e 100644 --- a/modules/home/rofi.nix +++ b/modules/home/rofi.nix @@ -250,6 +250,14 @@ ${themeRows} # blueman-manager GUI (services.blueman.enable, system-side). exec blueman-manager ;; + printers) + # system-config-printer GUI (the CUPS admin app), installed by + # nomarchy.services.printing. Self-gated in the System menu; guard + # here too in case it's invoked directly. + command -v system-config-printer >/dev/null 2>&1 \ + && exec system-config-printer + notify-send "Printers" "Not available (nomarchy.services.printing off?)."; exit 0 ;; + audio) # PipeWire (pulse) sink/source switcher via rofi-pulse-select. Self- # gated in the System menu on the pulse socket; guarded here too. @@ -360,6 +368,7 @@ ${themeRows} row "Bluetooth" bluetooth [ -e "''${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/pulse/native" ] \ && row "Audio" audio-volume-high + command -v system-config-printer >/dev/null 2>&1 && row "Printers" printer row "Do Not Disturb" notification-disabled systemctl --user cat hyprsunset.service >/dev/null 2>&1 \ && row "Night light" weather-clear-night @@ -374,6 +383,7 @@ ${themeRows} *Network*) exec "$0" network ;; *Bluetooth*) exec "$0" bluetooth ;; *Audio*) exec "$0" audio ;; + *Printers*) exec "$0" printers ;; *"Do Not Disturb"*) exec "$0" dnd ;; *"Night light"*) exec "$0" nightlight ;; *Snapshots*) exec "$0" snapshot ;; @@ -402,7 +412,7 @@ ${themeRows} esac ;; *) - echo "usage: nomarchy-menu [tools|system|power|power-profile|theme|clipboard|calc|files|emoji|web|network|bluetooth|audio|capture|keybinds|ask|dnd|nightlight|snapshot]" >&2 + echo "usage: nomarchy-menu [tools|system|power|power-profile|theme|clipboard|calc|files|emoji|web|network|bluetooth|audio|printers|capture|keybinds|ask|dnd|nightlight|snapshot]" >&2 exit 64 ;; esac ''; diff --git a/modules/nixos/services.nix b/modules/nixos/services.nix index d22636b..05a5a33 100644 --- a/modules/nixos/services.nix +++ b/modules/nixos/services.nix @@ -75,7 +75,8 @@ in printing.enable = lib.mkEnableOption '' CUPS printing with Avahi/mDNS, so network printers are auto-discovered - (add vendor drivers via `services.printing.drivers`)''; + (add vendor drivers via `services.printing.drivers`); the menu's + System ▸ Printers entry opens the system-config-printer GUI''; openrgb.enable = lib.mkEnableOption '' the OpenRGB daemon and GUI for controlling RGB lighting on peripherals @@ -246,6 +247,9 @@ in nssmdns4 = true; openFirewall = true; }; + # The CUPS admin GUI — the menu's System ▸ Printers entry execs it + # (self-gated on this binary), so it ships with the printing service. + environment.systemPackages = [ pkgs.system-config-printer ]; }) (lib.mkIf cfg.openrgb.enable {