From 945549699026df6c888a6b1bd4e06fbf55a67595 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 19 Aug 2026 20:16:47 +0200 Subject: [PATCH] Fix style inconsistencies in bin/ (#7518) * Use (( )) for the numeric argument test Co-Authored-By: Claude Fable 5 * Drop the quotes on a variable inside [[ ]] Co-Authored-By: Claude Fable 5 * Use omarchy-pkg-drop instead of raw pacman -Rns omarchy-pkg-drop already filters to installed packages, so the 2>/dev/null || true suppression is no longer needed. Co-Authored-By: Claude Fable 5 * Drop defensive checks around default-set commands ttfx, imagemagick, and networkmanager are all in the default package set, so their commands are runtime invariants and should be invoked directly. Removing the nmcli guard also removes the degraded wifi fallthrough that only ran when nmcli was missing. Co-Authored-By: Claude Fable 5 --------- Co-authored-by: Claude Fable 5 --- bin/omarchy-agent-usage-update | 2 +- bin/omarchy-chromium-ytdlp-host | 2 +- bin/omarchy-launch-screensaver | 4 ---- bin/omarchy-network-status | 21 ++++++++------------- bin/omarchy-remove-dev-env | 4 ++-- bin/omarchy-transcode-ascii | 5 ----- 6 files changed, 12 insertions(+), 26 deletions(-) diff --git a/bin/omarchy-agent-usage-update b/bin/omarchy-agent-usage-update index 8cbfac2e..fe452855 100755 --- a/bin/omarchy-agent-usage-update +++ b/bin/omarchy-agent-usage-update @@ -16,7 +16,7 @@ flags=() only=() declare -A excluded -while [[ $# -gt 0 ]]; do +while (( $# > 0 )); do case "$1" in --force | --limits-only) flags+=("$1") ;; --except) diff --git a/bin/omarchy-chromium-ytdlp-host b/bin/omarchy-chromium-ytdlp-host index aba03ba4..49160240 100755 --- a/bin/omarchy-chromium-ytdlp-host +++ b/bin/omarchy-chromium-ytdlp-host @@ -116,7 +116,7 @@ main() { local length payload url # Detached worker: this is what actually runs yt-dlp and fires notifications. - if [[ "${1:-}" == "--download" ]]; then + if [[ ${1:-} == "--download" ]]; then download_url "$2" fi diff --git a/bin/omarchy-launch-screensaver b/bin/omarchy-launch-screensaver index afee404b..c66c41da 100755 --- a/bin/omarchy-launch-screensaver +++ b/bin/omarchy-launch-screensaver @@ -2,10 +2,6 @@ # omarchy:summary=Launch the Omarchy screensaver in the default terminal on the system with the correct font configuration. -if omarchy-cmd-missing ttfx; then - exit 1 -fi - # Exit early if screensaver is already running pgrep -f '[o]rg.omarchy.screensaver' && exit 0 diff --git a/bin/omarchy-network-status b/bin/omarchy-network-status index b03df3bb..e97c6a29 100755 --- a/bin/omarchy-network-status +++ b/bin/omarchy-network-status @@ -34,23 +34,18 @@ print_status() { return fi - if omarchy-cmd-present nmcli; then - nm=$(nmcli -t -f GENERAL.STATE,GENERAL.CONNECTION dev show "$device" 2>/dev/null) - state=$(awk -F: '$1 == "GENERAL.STATE" { print $2; exit }' <<<"$nm") - ssid=$(awk -F: '$1 == "GENERAL.CONNECTION" { print $2; exit }' <<<"$nm") - signal=$(nmcli -t -f IN-USE,SIGNAL dev wifi list ifname "$device" --rescan no 2>/dev/null | awk -F: '$1 == "*" { print $2; exit }') - freq=$(iw dev "$device" link 2>/dev/null | awk '/freq:/ { print $2; exit }') + nm=$(nmcli -t -f GENERAL.STATE,GENERAL.CONNECTION dev show "$device" 2>/dev/null) + state=$(awk -F: '$1 == "GENERAL.STATE" { print $2; exit }' <<<"$nm") + ssid=$(awk -F: '$1 == "GENERAL.CONNECTION" { print $2; exit }' <<<"$nm") + signal=$(nmcli -t -f IN-USE,SIGNAL dev wifi list ifname "$device" --rescan no 2>/dev/null | awk -F: '$1 == "*" { print $2; exit }') + freq=$(iw dev "$device" link 2>/dev/null | awk '/freq:/ { print $2; exit }') - if [[ $state != 100* ]]; then - printf 'disconnected\t\t\t\n' - return - fi - - printf 'wifi\t%s\t%s\t%s\n' "${ssid:-$device}" "$signal" "$freq" + if [[ $state != 100* ]]; then + printf 'disconnected\t\t\t\n' return fi - printf 'wifi\t%s\t\t\n' "$device" + printf 'wifi\t%s\t%s\t%s\n' "${ssid:-$device}" "$signal" "$freq" } ping_latency_ms() { diff --git a/bin/omarchy-remove-dev-env b/bin/omarchy-remove-dev-env index 4551f1e1..a24e7f9e 100755 --- a/bin/omarchy-remove-dev-env +++ b/bin/omarchy-remove-dev-env @@ -10,7 +10,7 @@ if [[ -z $1 ]]; then fi remove_php() { - sudo pacman -Rns --noconfirm php composer php-sqlite xdebug 2>/dev/null || true + omarchy-pkg-drop php composer php-sqlite xdebug } case "$1" in @@ -50,7 +50,7 @@ laravel) ;; symfony) echo -e "Removing Symfony CLI...\n" - sudo pacman -Rns --noconfirm symfony-cli 2>/dev/null || true + omarchy-pkg-drop symfony-cli ;; python) echo -e "Removing Python...\n" diff --git a/bin/omarchy-transcode-ascii b/bin/omarchy-transcode-ascii index e105a7ed..0ce19acf 100755 --- a/bin/omarchy-transcode-ascii +++ b/bin/omarchy-transcode-ascii @@ -101,11 +101,6 @@ if [[ ! -f $image_path ]]; then exit 1 fi -if omarchy-cmd-missing magick; then - echo "ImageMagick is required to convert logo images" >&2 - exit 1 -fi - if [[ $mode == "braille" ]]; then pixel_width=$((width * 2)) pixel_height=$((height * 4))