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:
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Returns the battery full capacity in Wh (rounded to whole number).
|
||||
# Used by nomarchy-battery-status for displaying battery capacity.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Designed to be run by systemd timer every 30 seconds and alerts if battery is low
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Returns true if a battery is present on the system.
|
||||
# Used by the battery monitor and other battery-related checks.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Returns the battery percentage remaining as an integer.
|
||||
# Used by the battery monitor and the Ctrl + Shift + Super + B hotkey.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Returns the battery time remaining (to empty or full) in a compact format.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Returns a formatted battery status string with percentage and power draw/charge.
|
||||
# Used by the battery notification hotkey (Ctrl + Shift + Super + B).
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Adjust brightness on the most likely display device.
|
||||
# Usage: nomarchy-brightness-display <step>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Adjust the brightness on Apple Studio Displays and Apple XDR Displays using asdcontrol.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Adjust keyboard backlight brightness using available steps.
|
||||
# Usage: nomarchy-brightness-keyboard <up|down|cycle>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Check if hibernation is supported
|
||||
if [[ ! -f /sys/power/image_size ]]; then
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Removes hibernation setup: disables swap, removes swapfile, removes fstab entry,
|
||||
# removes resume hook, and removes suspend-then-hibernate configuration.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Creates a swap file in the btrfs subvolume, adds the swap file to /etc/fstab,
|
||||
# adds a resume hook to mkinitcpio, and configures suspend-then-hibernate.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Detect whether the computer is an Asus ROG machine.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Match against the computer's DMI product name (case-insensitive).
|
||||
# Usage: nomarchy-hw-match "XPS"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Detect whether Vulkan is available.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
PKG_NAME="$1"
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
PKG_NAME="$1"
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Returns a list of all the available power profiles on the system.
|
||||
# Used by the Nomarchy Menu under Setup > Power Profile.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
# Nomarchy Pre-flight State Migration
|
||||
# Migrates legacy state files into the unified state.json before Nix evaluation
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Unblock and restart the bluetooth service.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Restart the PipeWire audio service to fix audio issues or apply new configuration.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Reload the intel_quicki2c driver to fix a dead trackpad.
|
||||
# The THC (Touch Host Controller) can fail to initialize interrupts
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Unblock and restart the Wi-Fi service.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Restart the XCompose input method service (fcitx5) to apply new compose key settings.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Configure DNS declaratively for Nomarchy NixOS.
|
||||
# Hybrid: updates /etc/nixos/state.json and runs sys-update.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Configure FIDO2 support declaratively for Nomarchy NixOS.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Configure fingerprint support declaratively for Nomarchy NixOS.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Prompt for sudo once and keep the credential alive in the background.
|
||||
# Source this script so the trap applies to the calling shell:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Toggle passwordless sudo for the current user.
|
||||
# First run: enables passwordless sudo for 15 minutes (after confirmation).
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Reset the sudo lockout/faillock for the current user.
|
||||
# This clears any failed authentication attempts that may have locked the user out.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Display brightness level using SwayOSD on the current monitor.
|
||||
# Usage: nomarchy-swayosd-brightness <percent>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Display keyboard brightness level using SwayOSD on the current monitor.
|
||||
# Usage: nomarchy-swayosd-kbd-brightness <percent>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Logout command that first closes all application windows (thus giving them a chance to save state),
|
||||
# then stops the session, returning to the SDDM login screen.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Reboot command that first closes all application windows (thus giving them a chance to save state).
|
||||
# This is particularly helpful for applications like Chromium that otherwise won't shutdown cleanly.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Shutdown command that first closes all application windows (thus giving them a chance to save state).
|
||||
# This is particularly helpful for applications like Chromium that otherwise won't shutdown cleanly.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Toggle dedicated vs integrated GPU mode via supergfxd (for hybrid gpu laptops, like Asus G14).
|
||||
# Declarative enablement + Runtime mode switching for Nomarchy NixOS.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Toggles the idle daemon (hypridle) between enabled and disabled.
|
||||
# Hybrid: updates state.json and provides instant feedback.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Toggles the suspend menu option availability.
|
||||
# Hybrid: updates state.json and runs env-update for persistence.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Select system timezone declaratively for Nomarchy NixOS.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "Updating time..."
|
||||
sudo systemctl restart systemd-timesyncd
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Toggles wifi power saving declaratively.
|
||||
# Usage: nomarchy-wifi-powersave <on|off>
|
||||
|
||||
Reference in New Issue
Block a user