chore: add 'set -e' to every nomarchy-* bash script that lacks it

Sweep across the three script directories: features/scripts/utils,
core/system/scripts, themes/engine/scripts. 142 of 169 bash scripts
gained `set -e`; 27 already had it; the one Python helper
(nomarchy-haptic-touchpad) was skipped via shebang detection.

Why: bash's default behavior is to continue past a failed command,
which means a script that does "do A; do B; do C" leaves the system
in a half-applied state when B fails - and the user gets no signal.
Several recent fix commits (theme partial-apply, waybar reload race,
installer prewipe silent failures) all trace back to this. set -e
turns silent corruption into a loud abort the user can act on.

The 11 scripts with explicit `|| true` markers stay safe under set -e
because || true coerces the exit to zero; the markers continue to
mean "I deliberately tolerate this failure here."

Deliberate exception: nomarchy-menu runs WITHOUT set -e. It is an
interactive UX loop where action branches do `cmd; back_to <self>`
so a failed action would abort the script under set -e and the menu
would disappear without feedback. Soft-failure - menu re-displays,
user picks again - is the right semantic. Documented inline.

Validation: bash -n on every modified script (zero failures). The
new pre-commit hook (27f5663) was just updated to filter by shebang
so it doesn't try to bash-syntax-check the Python helper - that
filter was uncovered by this sweep.

Risk: set -e can surface latent bugs in scripts that previously
relied on silent continuation. If anything breaks, it's a real bug
that was already broken and is now visible. Easy per-script revert
if any UX glitches show up.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-04-30 20:50:13 +01:00
parent 27f5663cdf
commit 1e9481849b
143 changed files with 148 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Nomarchy Backup Script
# Alias for nomarchy-sync push.

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Build the Nomarchy Installer ISO declaratively using the flake.

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Build the Nomarchy Live ISO (Full Desktop Environment) using the flake.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Switch between audio outputs while preserving the mute status. By default mapped to Super + Mute.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Returns true if all the commands passed in as arguments exit on the system.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Start and stop a screenrecording, which will be saved to ~/Videos by default.
# Alternative location can be set via NOMARCHY_SCREENRECORD_DIR or XDG_VIDEOS_DIR ENVs.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Run the Nomarchy screensaver using random effects from TTE.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Take a screenshot of the whole screen, a specific window, or a user-drawn region.
# Saves to ~/Pictures by default, but that can be changed via NOMARCHY_SCREENSHOT_DIR or XDG_PICTURES_DIR ENVs.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Share clipboard, file, or folder using LocalSend. Bound to Super + Ctrl + S by default.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Returns the current working directory of the active terminal window,
# so a new terminal window can be started in the same directory.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Add an EFI boot entry for the Nomarchy UKI, allowing the system to boot directly
# without a bootloader like Limine. Requires UEFI firmware and a built UKI.

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Generator tolerates "no matches" exit codes from grep | sort.
# pipefail and -e off; -u stays.
set -u

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Returns drive information about a given volumne, like /dev/nvme0, which is used by nomarchy-drive-select.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Select a drive from a list with info that includes space and brand. Used by nomarchy-drive-set-password.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Set a new encryption password for a drive selected.

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Nomarchy Font Helper
# Usage: nomarchy-font [selector|set <name>|list]

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Toggles transparency for the currently focused window.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Get the active monitor (the one with the cursor)
MONITOR_INFO=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true)')

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Close all open windows
hyprctl clients -j | \

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Toggles the window gaps globally between no gaps and the default 10/5/2, declaratively and instantly.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Toggle to pop-out a tile to stay fixed on a display basis.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Check current single_window_aspect_ratio setting
CURRENT_VALUE=$(hyprctl getoption "layout:single_window_aspect_ratio" 2>/dev/null | head -1)

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Toggle the layout on the current active workspace between dwindle and scrolling

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Nomarchy Install Script
# Entry point for the Nomarchy installer.

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Nomarchy Docker DBs Stub
# This script is a stub for a specialized tool.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Launch the fastfetch TUI that gives information about the current system.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Launch the Nomarchy audio controls TUI (provided by wiremix).

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Launch the Nomarchy bluetooth controls TUI (provided by bluetui).
# Also attempts to unblock bluetooth service if rfkill had blocked it.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Launch the default browser as determined by xdg-settings.
# Automatically converts --private into the correct flag for the given browser.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Launch the default editor as determined by $EDITOR (set via ~/.config/uwsm/default) (or nvim if missing).
# Starts suitable editors in a terminal window and otherwise as a regular application.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Launch a floating terminal with the Nomarchy logo presentation, then execute the command passed in, and finally end with the nomarchy-show-done presentation.
# Used by actions such as Update System.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Launch or focus on a given command identified by the passed in window-pattern.
# Use by some default bindings, like the one for Spotify, to ensure there is only one instance of the application open.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Launch or focus on a given TUI identified by the passed in as the command.
# Use by commands like nomarchy-launch-wifi to ensure there is only one wifi configuration screen open.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Launch or focus on a given web app identified by the window-pattern.
# Use by some default bindings, like the one for WhatsApp, to ensure there is only one instance of the application open.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Launch the Nomarchy screensaver in the default terminal on the system with the correct font configuration.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Launch the TUI command passed in as an argument in the default terminal with an org.nomarchy.COMMAND app id for styling.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Wrapper to launch walker with elephant provider, or fallback to rofi if walker is missing.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Launch the passed in URL as a web app in the default browser (or chromium if the default doesn't support --app).

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Launch the Nomarchy wifi controls (provided by the Impala TUI).
# Attempts to unblock the wifi service first in case it should be been blocked.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Locks the system using hyprlock, but not before ensuring 1password has also been locked, and the screensaver stopped.

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Nomarchy Manual Script
# Opens the Nomarchy manual in the default web browser.

View File

@@ -1,6 +1,12 @@
#!/bin/bash
# Launch the Nomarchy Menu or takes a parameter to jump straight to a submenu.
#
# Deliberately runs WITHOUT `set -e`: this is an interactive UX loop, and
# action branches do `cmd; back_to <self>` so a failed action would abort
# the script under set -e and the menu would disappear without feedback.
# Soft-failure (the menu re-displays, the user picks again) is the right
# semantic here.
export PATH="$HOME/.local/share/nomarchy/bin:$PATH"

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Display Hyprland keybindings defined in your configuration using walker for an interactive search menu.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Dismiss a mako notification on the basis of its summary. Used by the first-run notifications to dismiss them after clicking for action.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Install an npx wrapper for a given npm package.
# Usage: nomarchy-npx-install <package> [command-name]

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Nomarchy on-boot initialization script.
# Automatically detects the hardware, applies necessary runtime tweaks,

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Nomarchy AUR Stub
# Informs the user that AUR is not applicable to NixOS.

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Nomarchy Package Drop Script
# Alias for nomarchy-pkg-remove.

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Nomarchy Package Install Script
# Alias for nomarchy-pkg-add for users coming from other distros.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# nomarchy-refresh-config: Restore a specific configuration file to its stock version.
# Usage: nomarchy-refresh-config <relative-path-to-config>

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Overwrite the user config for fastfetch with the Nomarchy default.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Restart an application by killing it and relaunching via uwsm.
# Usage: nomarchy-restart-app <application-name> [application-args...]

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Reload btop configuration (used by the Nomarchy theme switching).

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Reload hyprland configuration (used by the Nomarchy theme switching).

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Restart the hypridle service (used for idle detection and auto-lock).

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Restart the hyprsunset service (used for blue light filtering/night light).

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Reload mako configuration (used by the Nomarchy theme switching).

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Reload opencode configuration (used by the Nomarchy theme switching).

View File

@@ -1,3 +1,4 @@
#!/bin/bash
set -e
nomarchy-restart-app swayosd-server

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
if [[ -f ~/.config/alacritty/alacritty.toml ]]; then
touch ~/.config/alacritty/alacritty.toml

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Restart tmux if running with the latest configuration

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Walker (with runAsService = true) and elephant are Home Manager user
# services. Restart via systemd so the new process inherits the full graphical

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Reload waybar in place when it's already running. SIGUSR2 makes waybar
# re-read its config.jsonc and CSS (including @import-ed files like

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Nomarchy Skill Script
# Displays the Nomarchy Skill documentation for agents and power users.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Manage persistent runtime state files for Nomarchy indicators.
# Usage: nomarchy-state <set|clear> <state-name-or-pattern>

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Nomarchy Atomic State Write Helper
# Provides atomic JSON state updates with flock to prevent race conditions
#

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Build and run the Nomarchy Installer VM for testing.

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Build and run the Nomarchy VM (installed environment) for testing.

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Nomarchy Theme Helper
# Usage: nomarchy-theme [selector|set <name>|list]

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
makoctl mode -t do-not-disturb

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Toggles the screensaver availability.
# Hybrid: updates state.json and runs env-update for persistence.

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Toggles the waybar top bar.
# Hybrid: updates state.json and provides instant feedback.

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Nomarchy Update Available Script
# Checks if flake updates are available and returns info for Waybar

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Nomarchy Version Script
# Prints the current Nomarchy version based on the upstream NixOS channel.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
if nomarchy-cmd-present voxtype; then
voxtype status --follow --extended --format json | while read -r line; do

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Nomarchy Wallpaper Helper
# Usage: nomarchy-wallpaper [selector|set <path>|next]

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
url="$1"
web_url="https://app.hey.com"

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
url="$1"
web_url="https://app.zoom.us/wc/home"

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
STATE_FILE="$HOME/.config/nomarchy/state.json"

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
COMPOSE_FILE="$HOME/.config/windows/docker-compose.yml"
check_prerequisites() {