From 7514ae7dcff654ff555862ea95b7033ea740924f Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 21 Feb 2026 10:18:47 +0100 Subject: [PATCH] Use consistent bash5 style for conditionals and quoting --- AGENTS.md | 6 ++- bin/omarchy-battery-monitor | 4 +- bin/omarchy-battery-present | 6 +-- bin/omarchy-branch-set | 2 +- bin/omarchy-brightness-display | 2 +- bin/omarchy-brightness-display-apple | 2 +- bin/omarchy-brightness-keyboard | 12 ++--- bin/omarchy-cmd-audio-switch | 12 ++--- bin/omarchy-cmd-first-run | 2 +- bin/omarchy-cmd-screenrecord | 20 +++---- bin/omarchy-cmd-screenshot | 12 ++--- bin/omarchy-cmd-share | 2 +- bin/omarchy-debug | 8 +-- bin/omarchy-dev-add-migration | 2 +- bin/omarchy-drive-select | 2 +- bin/omarchy-drive-set-password | 2 +- bin/omarchy-font-set | 2 +- bin/omarchy-hibernation-available | 2 +- bin/omarchy-hibernation-remove | 4 +- bin/omarchy-hibernation-setup | 6 +-- bin/omarchy-hook | 2 +- bin/omarchy-hw-asus-rog | 2 +- bin/omarchy-hw-framework16 | 2 +- bin/omarchy-install-dev-env | 2 +- bin/omarchy-install-docker-dbs | 4 +- ...launch-floating-terminal-with-presentation | 2 +- bin/omarchy-launch-or-focus | 2 +- bin/omarchy-menu | 30 +++++------ bin/omarchy-menu-keybindings | 13 +++-- bin/omarchy-migrate | 2 +- bin/omarchy-pkg-aur-install | 2 +- bin/omarchy-pkg-install | 2 +- bin/omarchy-pkg-remove | 2 +- bin/omarchy-refresh-chromium | 4 +- bin/omarchy-refresh-config | 4 +- bin/omarchy-refresh-pacman | 2 +- bin/omarchy-reinstall-configs | 2 +- bin/omarchy-remove-dev-env | 2 +- bin/omarchy-restart-walker | 2 +- bin/omarchy-setup-dns | 4 +- bin/omarchy-setup-fido2 | 14 ++--- bin/omarchy-setup-fingerprint | 10 ++-- bin/omarchy-state | 4 +- bin/omarchy-swayosd-brightness | 2 +- bin/omarchy-swayosd-kbd-brightness | 2 +- bin/omarchy-theme-bg-next | 8 +-- bin/omarchy-theme-bg-set | 2 +- bin/omarchy-theme-install | 6 +-- bin/omarchy-theme-remove | 8 +-- bin/omarchy-theme-set | 2 +- bin/omarchy-theme-set-keyboard-f16 | 2 +- bin/omarchy-theme-set-obsidian | 6 +-- bin/omarchy-theme-set-vscode | 10 ++-- bin/omarchy-theme-update | 2 +- bin/omarchy-toggle-nightlight | 2 +- ...omarchy-toggle-single-window-square-aspect | 2 +- bin/omarchy-tui-install | 8 +-- bin/omarchy-tui-remove | 6 +-- bin/omarchy-tui-remove-all | 2 +- bin/omarchy-update | 2 +- bin/omarchy-update-available | 6 +-- bin/omarchy-update-branch | 4 +- bin/omarchy-update-restart | 6 +-- bin/omarchy-upload-log | 10 ++-- bin/omarchy-webapp-install | 4 +- bin/omarchy-webapp-remove | 6 +-- bin/omarchy-webapp-remove-all | 2 +- bin/omarchy-windows-vm | 52 +++++++++---------- install/config/git.sh | 4 +- .../config/hardware/fix-apple-spi-keyboard.sh | 4 +- .../config/hardware/fix-apple-suspend-nvme.sh | 4 +- .../hardware/fix-asus-rog-audio-mixer.sh | 2 +- .../config/hardware/fix-surface-keyboard.sh | 6 +-- install/config/hardware/intel.sh | 4 +- .../config/hardware/legacy-gpu-terminal.sh | 4 +- install/config/hardware/nvidia.sh | 8 +-- .../config/hardware/set-wireless-regdom.sh | 10 ++-- install/config/hardware/vulkan.sh | 2 +- install/config/mise-work.sh | 2 +- install/config/powerprofilesctl-rules.sh | 2 +- install/helpers/chroot.sh | 2 +- install/helpers/errors.sh | 8 +-- install/helpers/logging.sh | 16 +++--- install/helpers/presentation.sh | 6 +-- install/login/limine-snapper.sh | 8 +-- install/login/plymouth.sh | 2 +- install/login/sddm.sh | 2 +- install/post-install/finished.sh | 4 +- install/preflight/disable-mkinitcpio.sh | 4 +- install/preflight/guard.sh | 8 +-- migrations/1752292967.sh | 4 +- migrations/1752535084.sh | 2 +- migrations/1754860578.sh | 6 +-- migrations/1755109182.sh | 4 +- migrations/1755507891.sh | 4 +- migrations/1756491748.sh | 2 +- migrations/1757361127.sh | 2 +- migrations/1758107879.sh | 2 +- migrations/1758142943.sh | 2 +- migrations/1758436991.sh | 5 +- migrations/1758487662_move_to_custom_uki.sh | 2 +- migrations/1760304963.sh | 2 +- migrations/1760724934.sh | 2 +- migrations/1761180745.sh | 2 +- migrations/1761269603.sh | 2 +- migrations/1761569743.sh | 2 +- migrations/1762121828.sh | 10 ++-- migrations/1762446739.sh | 2 +- migrations/1762684663.sh | 2 +- migrations/1765729055.sh | 2 +- migrations/1767306902.sh | 12 ++--- migrations/1770159912.sh | 2 +- migrations/1771403119.sh | 2 +- 113 files changed, 289 insertions(+), 287 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index bac09b5a..c0c87cb3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,7 +1,11 @@ # Style - Two spaces for indentation, no tabs -- Use bash 5 syntax: `[[ ]]` for conditionals, not `[ ]`. Don't quote variables inside `[[ ]]` (e.g., `[[ -n $var ]]` not `[[ -n "$var" ]]`) +- Use bash 5 conditionals: use `[[ ]]` for string/file tests and `(( ))` for numeric tests +- In `[[ ]]`, don't quote variables, but do quote string literals when comparing values (e.g., `[[ $branch == "dev" ]]`) +- Prefer `(( ))` over numeric operators inside `[[ ]]` (e.g., `(( count < 50 ))`, not `[[ $count -lt 50 ]]`) +- For strings/paths with spaces, quote them instead of escaping spaces with `\ ` (e.g., `"$APP_DIR/Disk Usage.desktop"`, not `$APP_DIR/Disk\ Usage.desktop`) +- Shebangs must use `#!/bin/bash` consistently (never `#!/usr/bin/env bash`) # Command Naming diff --git a/bin/omarchy-battery-monitor b/bin/omarchy-battery-monitor index 84c42974..b0da0d9e 100755 --- a/bin/omarchy-battery-monitor +++ b/bin/omarchy-battery-monitor @@ -11,8 +11,8 @@ send_notification() { notify-send -u critical "󱐋 Time to recharge!" "Battery is down to ${1}%" -i battery-caution -t 30000 } -if [[ -n "$BATTERY_LEVEL" && "$BATTERY_LEVEL" =~ ^[0-9]+$ ]]; then - if [[ $BATTERY_STATE == "discharging" && $BATTERY_LEVEL -le $BATTERY_THRESHOLD ]]; then +if [[ -n $BATTERY_LEVEL && $BATTERY_LEVEL =~ ^[0-9]+$ ]]; then + if [[ $BATTERY_STATE == "discharging" ]] && (( BATTERY_LEVEL <= BATTERY_THRESHOLD )); then if [[ ! -f $NOTIFICATION_FLAG ]]; then send_notification $BATTERY_LEVEL touch $NOTIFICATION_FLAG diff --git a/bin/omarchy-battery-present b/bin/omarchy-battery-present index bcdab1eb..2b052a7a 100755 --- a/bin/omarchy-battery-present +++ b/bin/omarchy-battery-present @@ -4,9 +4,9 @@ # Used by the battery monitor and other battery-related checks. for bat in /sys/class/power_supply/BAT*; do - [[ -r "$bat/present" ]] && - [[ "$(cat "$bat/present")" == "1" ]] && - [[ "$(cat "$bat/type")" == "Battery" ]] && + [[ -r $bat/present ]] && + [[ $(cat $bat/present) == "1" ]] && + [[ $(cat $bat/type) == "Battery" ]] && exit 0 done diff --git a/bin/omarchy-branch-set b/bin/omarchy-branch-set index bfe67c99..87d19bda 100755 --- a/bin/omarchy-branch-set +++ b/bin/omarchy-branch-set @@ -9,7 +9,7 @@ else branch="$1" fi -if [[ "$branch" != "master" && "$branch" != "rc" && "$branch" != "dev" ]]; then +if [[ $branch != "master" && $branch != "rc" && $branch != "dev" ]]; then echo "Error: Invalid branch '$branch'. Must be one of: master, rc, dev" exit 1 fi diff --git a/bin/omarchy-brightness-display b/bin/omarchy-brightness-display index d85795d2..493265d4 100755 --- a/bin/omarchy-brightness-display +++ b/bin/omarchy-brightness-display @@ -8,7 +8,7 @@ step="${1:-+5%}" # Start with the first possible output, then refine to the most likely given an order heuristic. device="$(ls -1 /sys/class/backlight 2>/dev/null | head -n1)" for candidate in amdgpu_bl* intel_backlight acpi_video*; do - if [[ -e "/sys/class/backlight/$candidate" ]]; then + if [[ -e /sys/class/backlight/$candidate ]]; then device="$candidate" break fi diff --git a/bin/omarchy-brightness-display-apple b/bin/omarchy-brightness-display-apple index 00fde072..64006820 100755 --- a/bin/omarchy-brightness-display-apple +++ b/bin/omarchy-brightness-display-apple @@ -2,7 +2,7 @@ # Adjust the brightness on Apple Studio Displays and Apple XDR Displays using asdcontrol. -if [[ $# -eq 0 ]]; then +if (( $# == 0 )); then echo "Adjust Apple Display Brightness by passing +5000 or -5000 (or any range from 0-60000)" else device="$(sudo asdcontrol --detect /dev/usb/hiddev* | grep ^/dev/usb/hiddev | cut -d: -f1)" diff --git a/bin/omarchy-brightness-keyboard b/bin/omarchy-brightness-keyboard index a05922d2..8c35b0ee 100755 --- a/bin/omarchy-brightness-keyboard +++ b/bin/omarchy-brightness-keyboard @@ -8,13 +8,13 @@ direction="${1:-up}" # Find keyboard backlight device (look for *kbd_backlight* pattern in leds class). device="" for candidate in /sys/class/leds/*kbd_backlight*; do - if [[ -e "$candidate" ]]; then + if [[ -e $candidate ]]; then device="$(basename "$candidate")" break fi done -if [[ -z "$device" ]]; then +if [[ -z $device ]]; then echo "No keyboard backlight device found" >&2 exit 1 fi @@ -24,14 +24,14 @@ max_brightness="$(brightnessctl -d "$device" max)" current_brightness="$(brightnessctl -d "$device" get)" # Calculate step as one unit (keyboards typically have discrete levels like 0-3). -if [[ "$direction" == "cycle" ]]; then +if [[ $direction == "cycle" ]]; then new_brightness=$(( (current_brightness + 1) % (max_brightness + 1) )) -elif [[ "$direction" == "up" ]]; then +elif [[ $direction == "up" ]]; then new_brightness=$((current_brightness + 1)) - [[ $new_brightness -gt $max_brightness ]] && new_brightness=$max_brightness + (( new_brightness > max_brightness )) && new_brightness=$max_brightness else new_brightness=$((current_brightness - 1)) - [[ $new_brightness -lt 0 ]] && new_brightness=0 + (( new_brightness < 0 )) && new_brightness=0 fi # Set the new brightness. diff --git a/bin/omarchy-cmd-audio-switch b/bin/omarchy-cmd-audio-switch index b68aaef4..1cb51086 100755 --- a/bin/omarchy-cmd-audio-switch +++ b/bin/omarchy-cmd-audio-switch @@ -7,7 +7,7 @@ focused_monitor="$(hyprctl monitors -j | jq -r '.[] | select(.focused == true).n sinks=$(pactl -f json list sinks | jq '[.[] | select((.ports | length == 0) or ([.ports[]? | .availability != "not available"] | any))]') sinks_count=$(echo "$sinks" | jq '. | length') -if [ "$sinks_count" -eq 0 ]; then +if (( sinks_count == 0 )); then swayosd-client \ --monitor "$focused_monitor" \ --custom-message "No audio devices found" @@ -17,7 +17,7 @@ fi current_sink_name=$(pactl get-default-sink) current_sink_index=$(echo "$sinks" | jq -r --arg name "$current_sink_name" 'map(.name) | index($name)') -if [ "$current_sink_index" != "null" ]; then +if [[ $current_sink_index != "null" ]]; then next_sink_index=$(((current_sink_index + 1) % sinks_count)) else next_sink_index=0 @@ -44,11 +44,11 @@ next_sink_volume=$(echo "$next_sink" | jq -r \ '.volume | to_entries[0].value.value_percent | sub("%"; "")') next_sink_is_muted=$(echo "$next_sink" | jq -r '.mute') -if [ "$next_sink_is_muted" = "true" ] || [ "$next_sink_volume" -eq 0 ]; then +if [[ $next_sink_is_muted = "true" ]] || (( next_sink_volume == 0 )); then icon_state="muted" -elif [ "$next_sink_volume" -le 33 ]; then +elif (( next_sink_volume <= 33 )); then icon_state="low" -elif [ "$next_sink_volume" -le 66 ]; then +elif (( next_sink_volume <= 66 )); then icon_state="medium" else icon_state="high" @@ -56,7 +56,7 @@ fi next_sink_volume_icon="sink-volume-${icon_state}-symbolic" -if [ "$next_sink_name" != "$current_sink_name" ]; then +if [[ $next_sink_name != $current_sink_name ]]; then pactl set-default-sink "$next_sink_name" fi diff --git a/bin/omarchy-cmd-first-run b/bin/omarchy-cmd-first-run index db3b229b..830bef54 100755 --- a/bin/omarchy-cmd-first-run +++ b/bin/omarchy-cmd-first-run @@ -6,7 +6,7 @@ set -e FIRST_RUN_MODE=~/.local/state/omarchy/first-run.mode -if [[ -f "$FIRST_RUN_MODE" ]]; then +if [[ -f $FIRST_RUN_MODE ]]; then rm -f "$FIRST_RUN_MODE" bash "$OMARCHY_PATH/install/first-run/battery-monitor.sh" diff --git a/bin/omarchy-cmd-screenrecord b/bin/omarchy-cmd-screenrecord index 05c9d51f..89221a78 100755 --- a/bin/omarchy-cmd-screenrecord +++ b/bin/omarchy-cmd-screenrecord @@ -6,7 +6,7 @@ [[ -f ~/.config/user-dirs.dirs ]] && source ~/.config/user-dirs.dirs OUTPUT_DIR="${OMARCHY_SCREENRECORD_DIR:-${XDG_VIDEOS_DIR:-$HOME/Videos}}" -if [[ ! -d "$OUTPUT_DIR" ]]; then +if [[ ! -d $OUTPUT_DIR ]]; then notify-send "Screen recording directory does not exist: $OUTPUT_DIR" -u critical -t 3000 exit 1 fi @@ -35,9 +35,9 @@ start_webcam_overlay() { cleanup_webcam # Auto-detect first available webcam if none specified - if [[ -z "$WEBCAM_DEVICE" ]]; then + if [[ -z $WEBCAM_DEVICE ]]; then WEBCAM_DEVICE=$(v4l2-ctl --list-devices 2>/dev/null | grep -m1 "^\s*/dev/video" | tr -d '\t') - if [[ -z "$WEBCAM_DEVICE" ]]; then + if [[ -z $WEBCAM_DEVICE ]]; then notify-send "No webcam devices found" -u critical -t 3000 return 1 fi @@ -76,15 +76,15 @@ start_screenrecording() { local audio_devices="" local audio_args="" - [[ "$DESKTOP_AUDIO" == "true" ]] && audio_devices+="default_output" + [[ $DESKTOP_AUDIO == "true" ]] && audio_devices+="default_output" - if [[ "$MICROPHONE_AUDIO" == "true" ]]; then + if [[ $MICROPHONE_AUDIO == "true" ]]; then # Merge audio tracks into one - separate tracks only play one at a time in most players - [[ -n "$audio_devices" ]] && audio_devices+="|" + [[ -n $audio_devices ]] && audio_devices+="|" audio_devices+="default_input" fi - [[ -n "$audio_devices" ]] && audio_args+="-a $audio_devices" + [[ -n $audio_devices ]] && audio_args+="-a $audio_devices" gpu-screen-recorder -w portal -f 60 -fallback-cpu-encoding yes -o "$filename" $audio_args -ac aac & toggle_screenrecording_indicator @@ -95,7 +95,7 @@ stop_screenrecording() { # Wait a maximum of 5 seconds to finish before hard killing local count=0 - while pgrep -f "^gpu-screen-recorder" >/dev/null && [ $count -lt 50 ]; do + while pgrep -f "^gpu-screen-recorder" >/dev/null && (( count < 50 )); do sleep 0.1 count=$((count + 1)) done @@ -125,8 +125,8 @@ if screenrecording_active; then else stop_screenrecording fi -elif [[ "$STOP_RECORDING" == "false" ]]; then - [[ "$WEBCAM" == "true" ]] && start_webcam_overlay +elif [[ $STOP_RECORDING == "false" ]]; then + [[ $WEBCAM == "true" ]] && start_webcam_overlay start_screenrecording || cleanup_webcam else diff --git a/bin/omarchy-cmd-screenshot b/bin/omarchy-cmd-screenshot index c33ecf1f..90555a23 100755 --- a/bin/omarchy-cmd-screenshot +++ b/bin/omarchy-cmd-screenshot @@ -7,7 +7,7 @@ [[ -f ~/.config/user-dirs.dirs ]] && source ~/.config/user-dirs.dirs OUTPUT_DIR="${OMARCHY_SCREENSHOT_DIR:-${XDG_PICTURES_DIR:-$HOME/Pictures}}" -if [[ ! -d "$OUTPUT_DIR" ]]; then +if [[ ! -d $OUTPUT_DIR ]]; then notify-send "Screenshot directory does not exist: $OUTPUT_DIR" -u critical -t 3000 exit 1 fi @@ -19,7 +19,7 @@ SCREENSHOT_EDITOR="${OMARCHY_SCREENSHOT_EDITOR:-satty}" # Parse --editor flag from any position ARGS=() for arg in "$@"; do - if [[ "$arg" == --editor=* ]]; then + if [[ $arg == --editor=* ]]; then SCREENSHOT_EDITOR="${arg#--editor=}" else ARGS+=("$arg") @@ -29,7 +29,7 @@ set -- "${ARGS[@]}" open_editor() { local filepath="$1" - if [[ "$SCREENSHOT_EDITOR" == "satty" ]]; then + if [[ $SCREENSHOT_EDITOR == "satty" ]]; then satty --filename "$filepath" \ --output-filename "$filepath" \ --actions-on-enter save-to-clipboard \ @@ -89,13 +89,13 @@ case "$MODE" in # If the selection area is L * W < 20, we'll assume you were trying to select whichever # window or output it was inside of to prevent accidental 2px snapshots - if [[ "$SELECTION" =~ ^([0-9]+),([0-9]+)[[:space:]]([0-9]+)x([0-9]+)$ ]]; then + if [[ $SELECTION =~ ^([0-9]+),([0-9]+)[[:space:]]([0-9]+)x([0-9]+)$ ]]; then if ((${BASH_REMATCH[3]} * ${BASH_REMATCH[4]} < 20)); then click_x="${BASH_REMATCH[1]}" click_y="${BASH_REMATCH[2]}" while IFS= read -r rect; do - if [[ "$rect" =~ ^([0-9]+),([0-9]+)[[:space:]]([0-9]+)x([0-9]+) ]]; then + if [[ $rect =~ ^([0-9]+),([0-9]+)[[:space:]]([0-9]+)x([0-9]+) ]]; then rect_x="${BASH_REMATCH[1]}" rect_y="${BASH_REMATCH[2]}" rect_width="${BASH_REMATCH[3]}" @@ -123,7 +123,7 @@ if [[ $PROCESSING == "slurp" ]]; then ( ACTION=$(notify-send "Screenshot saved to clipboard and file" "Edit with Super + Alt + , (or click this)" -t 10000 -i "$FILEPATH" -A "default=edit") - [[ "$ACTION" == "default" ]] && open_editor "$FILEPATH" + [[ $ACTION == "default" ]] && open_editor "$FILEPATH" ) & else grim -g "$SELECTION" - | wl-copy diff --git a/bin/omarchy-cmd-share b/bin/omarchy-cmd-share index 96fd3d38..81535549 100755 --- a/bin/omarchy-cmd-share +++ b/bin/omarchy-cmd-share @@ -25,7 +25,7 @@ else # Pick one or more files from home directory FILES=$(find "$HOME" -type f 2>/dev/null | fzf --multi) fi - [ -z "$FILES" ] && exit 0 + [[ -z $FILES ]] && exit 0 fi fi diff --git a/bin/omarchy-debug b/bin/omarchy-debug index 12ed6afd..23b6630d 100755 --- a/bin/omarchy-debug +++ b/bin/omarchy-debug @@ -5,7 +5,7 @@ NO_SUDO=false PRINT_ONLY=false -while [[ $# -gt 0 ]]; do +while (( $# > 0 )); do case "$1" in --no-sudo) NO_SUDO=true @@ -25,7 +25,7 @@ done LOG_FILE="/tmp/omarchy-debug.log" -if [ "$NO_SUDO" = true ]; then +if [[ $NO_SUDO = "true" ]]; then DMESG_OUTPUT="(skipped - --no-sudo flag used)" else DMESG_OUTPUT="$(sudo dmesg)" @@ -57,7 +57,7 @@ INSTALLED PACKAGES $({ expac -S '%n %v (%r)' $(pacman -Qqe) 2>/dev/null; comm -13 <(pacman -Sql | sort) <(pacman -Qqe | sort) | xargs -r expac -Q '%n %v (AUR)'; } | sort) EOF -if [ "$PRINT_ONLY" = true ]; then +if [[ $PRINT_ONLY = "true" ]]; then cat "$LOG_FILE" exit 0 fi @@ -73,7 +73,7 @@ case "$ACTION" in "Upload log") echo "Uploading debug log to 0x0.st..." URL=$(curl -sF "file=@$LOG_FILE" -Fexpires=24 https://0x0.st) - if [ $? -eq 0 ] && [ -n "$URL" ]; then + if (( $? == 0 )) && [[ -n $URL ]]; then echo "✓ Log uploaded successfully!" echo "Share this URL:" echo "" diff --git a/bin/omarchy-dev-add-migration b/bin/omarchy-dev-add-migration index c662bc56..3ca47a2f 100755 --- a/bin/omarchy-dev-add-migration +++ b/bin/omarchy-dev-add-migration @@ -7,7 +7,7 @@ cd ~/.local/share/omarchy migration_file="$HOME/.local/share/omarchy/migrations/$(git log -1 --format=%cd --date=unix).sh" touch $migration_file -if [[ "$1" != "--no-edit" ]]; then +if [[ $1 != "--no-edit" ]]; then nvim $migration_file fi diff --git a/bin/omarchy-drive-select b/bin/omarchy-drive-select index a4b82a5e..14afcc22 100755 --- a/bin/omarchy-drive-select +++ b/bin/omarchy-drive-select @@ -10,7 +10,7 @@ fi drives_with_info="" while IFS= read -r drive; do - [[ -n "$drive" ]] || continue + [[ -n $drive ]] || continue drives_with_info+="$(omarchy-drive-info "$drive")"$'\n' done <<<"$drives" diff --git a/bin/omarchy-drive-set-password b/bin/omarchy-drive-set-password index e014f6dd..baf4d1ba 100755 --- a/bin/omarchy-drive-set-password +++ b/bin/omarchy-drive-set-password @@ -5,7 +5,7 @@ encrypted_drives=$(blkid -t TYPE=crypto_LUKS -o device) if [[ -n $encrypted_drives ]]; then - if [[ $(wc -l <<<"$encrypted_drives") -eq 1 ]]; then + if (( $(wc -l << HIBERNATION_IMAGE_SIZE )) && [[ -f /etc/mkinitcpio.conf.d/omarchy_resume.conf ]]; then exit 0 else exit 1 diff --git a/bin/omarchy-hibernation-remove b/bin/omarchy-hibernation-remove index aad216f9..2901a88a 100755 --- a/bin/omarchy-hibernation-remove +++ b/bin/omarchy-hibernation-remove @@ -6,7 +6,7 @@ MKINITCPIO_CONF="/etc/mkinitcpio.conf.d/omarchy_resume.conf" # Check if hibernation is configured -if [ ! -f "$MKINITCPIO_CONF" ] || ! grep -q "^HOOKS+=(resume)$" "$MKINITCPIO_CONF"; then +if [[ ! -f $MKINITCPIO_CONF ]] || ! grep -q "^HOOKS+=(resume)$" "$MKINITCPIO_CONF"; then echo "Hibernation is not set up" exit 0 fi @@ -25,7 +25,7 @@ if swapon --show | grep -q "$SWAP_FILE"; then fi # Remove swapfile -if [ -f "$SWAP_FILE" ]; then +if [[ -f $SWAP_FILE ]]; then echo "Removing swapfile" sudo rm "$SWAP_FILE" fi diff --git a/bin/omarchy-hibernation-setup b/bin/omarchy-hibernation-setup index a43d34ec..e06e3bc0 100755 --- a/bin/omarchy-hibernation-setup +++ b/bin/omarchy-hibernation-setup @@ -12,7 +12,7 @@ fi MKINITCPIO_CONF="/etc/mkinitcpio.conf.d/omarchy_resume.conf" # Check if hibernation is already configured -if [ -f "$MKINITCPIO_CONF" ] && grep -q "^HOOKS+=(resume)$" "$MKINITCPIO_CONF"; then +if [[ -f $MKINITCPIO_CONF ]] && grep -q "^HOOKS+=(resume)$" "$MKINITCPIO_CONF"; then echo "Hibernation is already set up" exit 0 fi @@ -65,7 +65,7 @@ sudo cp -p "$OMARCHY_PATH/default/systemd/system-sleep/keyboard-backlight" /usr/ # Add resume= kernel parameters so the initramfs resume hook knows where to find the # hibernation image. Without these, resume happens late (after GPU drivers load) and fails. RESUME_DROP_IN="/etc/limine-entry-tool.d/resume.conf" -if [[ ! -f "$RESUME_DROP_IN" ]]; then +if [[ ! -f $RESUME_DROP_IN ]]; then echo "Adding resume kernel parameters" sudo swapon -p 0 "$SWAP_FILE" 2>/dev/null RESUME_DEVICE=$(findmnt -no SOURCE -T "$SWAP_FILE" | sed 's/\[.*\]//') @@ -77,7 +77,7 @@ fi # Use ACPI alarm for RTC wakeup on s2idle systems (needed for suspend-then-hibernate) if grep -q "\[s2idle\]" /sys/power/mem_sleep 2>/dev/null; then LIMINE_DROP_IN="/etc/limine-entry-tool.d/rtc-alarm.conf" - if [[ ! -f "$LIMINE_DROP_IN" ]]; then + if [[ ! -f $LIMINE_DROP_IN ]]; then echo "Enabling ACPI RTC alarm for s2idle suspend" sudo mkdir -p /etc/limine-entry-tool.d echo 'KERNEL_CMDLINE[default]+="rtc_cmos.use_acpi_alarm=1"' | sudo tee "$LIMINE_DROP_IN" >/dev/null diff --git a/bin/omarchy-hook b/bin/omarchy-hook index 75033bfc..fb670f02 100755 --- a/bin/omarchy-hook +++ b/bin/omarchy-hook @@ -4,7 +4,7 @@ set -e -if [[ $# -lt 1 ]]; then +if (( $# < 1 )); then echo "Usage: omarchy-hook [name] [args...]" exit 1 fi diff --git a/bin/omarchy-hw-asus-rog b/bin/omarchy-hw-asus-rog index 3a0e27af..6897d734 100755 --- a/bin/omarchy-hw-asus-rog +++ b/bin/omarchy-hw-asus-rog @@ -2,5 +2,5 @@ # Detect whether the computer is an Asus ROG machine. -[[ "$(cat /sys/class/dmi/id/sys_vendor 2>/dev/null)" == "ASUSTeK COMPUTER INC." ]] && +[[ $(cat /sys/class/dmi/id/sys_vendor 2>/dev/null) == "ASUSTeK COMPUTER INC." ]] && grep -q "ROG" /sys/class/dmi/id/product_family 2>/dev/null diff --git a/bin/omarchy-hw-framework16 b/bin/omarchy-hw-framework16 index dffceb04..d1e03c1d 100755 --- a/bin/omarchy-hw-framework16 +++ b/bin/omarchy-hw-framework16 @@ -2,5 +2,5 @@ # Detect whether the computer is a Framework Laptop 16. -[[ "$(cat /sys/class/dmi/id/sys_vendor 2>/dev/null)" == "Framework" ]] && +[[ $(cat /sys/class/dmi/id/sys_vendor 2>/dev/null) == "Framework" ]] && grep -q "Laptop 16" /sys/class/dmi/id/product_name 2>/dev/null diff --git a/bin/omarchy-install-dev-env b/bin/omarchy-install-dev-env index f8d85f91..f1cd31b8 100755 --- a/bin/omarchy-install-dev-env +++ b/bin/omarchy-install-dev-env @@ -11,7 +11,7 @@ install_php() { omarchy-pkg-add php composer php-sqlite xdebug # Install Path for Composer - if [[ ":$PATH:" != *":$HOME/.config/composer/vendor/bin:"* ]]; then + if [[ :$PATH: != *:$HOME/.config/composer/vendor/bin:* ]]; then echo 'export PATH="$HOME/.config/composer/vendor/bin:$PATH"' >>"$HOME/.bashrc" source "$HOME/.bashrc" echo "Added Composer global bin directory to PATH." diff --git a/bin/omarchy-install-docker-dbs b/bin/omarchy-install-docker-dbs index 4d29878a..abfacdc7 100755 --- a/bin/omarchy-install-docker-dbs +++ b/bin/omarchy-install-docker-dbs @@ -5,13 +5,13 @@ options=("MySQL" "PostgreSQL" "Redis" "MongoDB" "MariaDB" "MSSQL") -if [[ "$#" -eq 0 ]]; then +if (( $# == 0 )); then choices=$(printf "%s\n" "${options[@]}" | gum choose --header "Select database (return to install, esc to cancel)") || main_menu else choices="$@" fi -if [[ -n "$choices" ]]; then +if [[ -n $choices ]]; then for db in $choices; do case $db in MySQL) sudo docker run -d --restart unless-stopped -p "127.0.0.1:3306:3306" --name=mysql8 -e MYSQL_ROOT_PASSWORD= -e MYSQL_ALLOW_EMPTY_PASSWORD=true mysql:8.4 ;; diff --git a/bin/omarchy-launch-floating-terminal-with-presentation b/bin/omarchy-launch-floating-terminal-with-presentation index b85fed2e..eac1cbb7 100755 --- a/bin/omarchy-launch-floating-terminal-with-presentation +++ b/bin/omarchy-launch-floating-terminal-with-presentation @@ -4,4 +4,4 @@ # Used by actions such as Update System. cmd="$*" -exec setsid uwsm-app -- xdg-terminal-exec --app-id=org.omarchy.terminal --title=Omarchy -e bash -c "omarchy-show-logo; $cmd; if [ \$? -ne 130 ]; then omarchy-show-done; fi" +exec setsid uwsm-app -- xdg-terminal-exec --app-id=org.omarchy.terminal --title=Omarchy -e bash -c "omarchy-show-logo; $cmd; if (( \$? != 130 )); then omarchy-show-done; fi" diff --git a/bin/omarchy-launch-or-focus b/bin/omarchy-launch-or-focus index 85ab3d6c..1654c844 100755 --- a/bin/omarchy-launch-or-focus +++ b/bin/omarchy-launch-or-focus @@ -10,7 +10,7 @@ fi WINDOW_PATTERN="$1" LAUNCH_COMMAND="${2:-"uwsm-app -- $WINDOW_PATTERN"}" -WINDOW_ADDRESS=$(hyprctl clients -j | jq -r --arg p "$WINDOW_PATTERN" '.[]|select((.class|test("\\b" + $p + "\\b";"i")) or (.title|test("\\b" + $p + "\\b";"i")))|.address' | head -n1) +WINDOW_ADDRESS=$(hyprctl clients -j | jq -r --arg p "$WINDOW_PATTERN" '.[]|select((.class|test("\\b" + p + "\\b";"i")) or (.title|test("\\b" + $p + "\\b";"i")))|.address' | head -n1) if [[ -n $WINDOW_ADDRESS ]]; then hyprctl dispatch focuswindow "address:$WINDOW_ADDRESS" diff --git a/bin/omarchy-menu b/bin/omarchy-menu index 84628c63..f211768c 100755 --- a/bin/omarchy-menu +++ b/bin/omarchy-menu @@ -10,9 +10,9 @@ BACK_TO_EXIT=false back_to() { local parent_menu="$1" - if [[ "$BACK_TO_EXIT" == "true" ]]; then + if [[ $BACK_TO_EXIT == "true" ]]; then exit 0 - elif [[ -n "$parent_menu" ]]; then + elif [[ -n $parent_menu ]]; then "$parent_menu" else show_main_menu @@ -27,10 +27,10 @@ menu() { read -r -a args <<<"$extra" - if [[ -n "$preselect" ]]; then + if [[ -n $preselect ]]; then local index index=$(echo -e "$options" | grep -nxF "$preselect" | cut -d: -f1) - if [[ -n "$index" ]]; then + if [[ -n $index ]]; then args+=("-c" "$index") fi fi @@ -108,11 +108,11 @@ show_capture_menu() { get_webcam_list() { v4l2-ctl --list-devices 2>/dev/null | while IFS= read -r line; do - if [[ "$line" != $'\t'* && -n "$line" ]]; then + if [[ $line != $'\t'* && -n $line ]]; then local name="$line" IFS= read -r device || break device=$(echo "$device" | tr -d '\t' | head -1) - [[ -n "$device" ]] && echo "$device $name" + [[ -n $device ]] && echo "$device $name" fi done } @@ -121,12 +121,12 @@ show_webcam_select_menu() { local devices=$(get_webcam_list) local count=$(echo "$devices" | grep -c . 2>/dev/null || echo 0) - if [[ -z "$devices" || "$count" -eq 0 ]]; then + if [[ -z $devices ]] || (( count == 0 )); then notify-send "No webcam devices found" -u critical -t 3000 return 1 fi - if [[ "$count" -eq 1 ]]; then + if (( count == 1 )); then echo "$devices" | awk '{print $1}' else menu "Select Webcam" "$devices" | awk '{print $1}' @@ -199,7 +199,7 @@ show_background_menu() { show_font_menu() { theme=$(menu "Font" "$(omarchy-font-list)" "--width 350" "$(omarchy-font-current)") - if [[ "$theme" == "CNCLD" || -z "$theme" ]]; then + if [[ $theme == "CNCLD" || -z $theme ]]; then back_to show_style_menu else omarchy-font-set "$theme" @@ -208,8 +208,8 @@ show_font_menu() { show_setup_menu() { local options=" Audio\n Wifi\n󰂯 Bluetooth\n󱐋 Power Profile\n System Sleep\n󰍹 Monitors" - [ -f ~/.config/hypr/bindings.conf ] && options="$options\n Keybindings" - [ -f ~/.config/hypr/input.conf ] && options="$options\n Input" + [[ -f ~/.config/hypr/bindings.conf ]] && options="$options\n Keybindings" + [[ -f ~/.config/hypr/input.conf ]] && options="$options\n Input" options="$options\n󰱔 DNS\n Security\n Config" case $(menu "Setup" "$options") in @@ -231,7 +231,7 @@ show_setup_menu() { show_setup_power_menu() { profile=$(menu "Power Profile" "$(omarchy-powerprofiles-list)" "" "$(powerprofilesctl get)") - if [[ "$profile" == "CNCLD" || -z "$profile" ]]; then + if [[ $profile == "CNCLD" || -z $profile ]]; then back_to show_setup_menu else powerprofilesctl set "$profile" @@ -264,7 +264,7 @@ show_setup_config_menu() { show_setup_system_menu() { local options="" - if [ -f ~/.local/state/omarchy/toggles/suspend-on ]; then + if [[ -f ~/.local/state/omarchy/toggles/suspend-on ]]; then options="$options󰒲 Disable Suspend" else options="$options󰒲 Enable Suspend" @@ -567,7 +567,7 @@ show_about() { show_system_menu() { local options=" Lock\n󱄄 Screensaver" - [ -f ~/.local/state/omarchy/toggles/suspend-on ] && options="$options\n󰒲 Suspend" + [[ -f ~/.local/state/omarchy/toggles/suspend-on ]] && options="$options\n󰒲 Suspend" omarchy-hibernation-available && options="$options\n󰤁 Hibernate" options="$options\n󰜉 Restart\n󰐥 Shutdown" @@ -611,7 +611,7 @@ go_to_menu() { USER_EXTENSIONS="$HOME/.config/omarchy/extensions/menu.sh" [[ -f $USER_EXTENSIONS ]] && source "$USER_EXTENSIONS" -if [[ -n "$1" ]]; then +if [[ -n $1 ]]; then BACK_TO_EXIT=true go_to_menu "$1" else diff --git a/bin/omarchy-menu-keybindings b/bin/omarchy-menu-keybindings index fcd31a98..ab7e92fe 100755 --- a/bin/omarchy-menu-keybindings +++ b/bin/omarchy-menu-keybindings @@ -12,7 +12,7 @@ build_keymap_cache() { } while IFS=, read -r code sym; do - [[ -z "$code" || -z "$sym" ]] && continue + [[ -z $code || -z $sym ]] && continue KEYCODE_SYM_MAP["$code"]="$sym" done < <( awk ' @@ -42,13 +42,13 @@ lookup_keycode_cached() { parse_keycodes() { local start end elapsed - [[ "${DEBUG:-0}" == "1" ]] && start=$(date +%s.%N) + [[ ${DEBUG:-0} == "1" ]] && start=$(date +%s.%N) while IFS= read -r line; do - if [[ "$line" =~ code:([0-9]+) ]]; then + if [[ $line =~ code:([0-9]+) ]]; then code="${BASH_REMATCH[1]}" symbol=$(lookup_keycode_cached "$code" "$XKB_KEYMAP_CACHE") echo "${line/code:${code}/$symbol}" - elif [[ "$line" =~ mouse:([0-9]+) ]]; then + elif [[ $line =~ mouse:([0-9]+) ]]; then code="${BASH_REMATCH[1]}" case "$code" in @@ -64,7 +64,7 @@ parse_keycodes() { fi done - if [[ "$DEBUG" == "1" ]]; then + if [[ $DEBUG == "1" ]]; then end=$(date +%s.%N) # fall back to awk if bc is missing if command -v bc >/dev/null 2>&1; then @@ -233,7 +233,7 @@ output_keybindings() { prioritize_entries } -if [[ "$1" == "--print" || "$1" == "-p" ]]; then +if [[ $1 == "--print" || $1 == "-p" ]]; then output_keybindings else monitor_height=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .height') @@ -242,4 +242,3 @@ else output_keybindings | walker --dmenu -p 'Keybindings' --width 800 --height "$menu_height" fi - diff --git a/bin/omarchy-migrate b/bin/omarchy-migrate index 2bb5a468..a60cba74 100755 --- a/bin/omarchy-migrate +++ b/bin/omarchy-migrate @@ -13,7 +13,7 @@ mkdir -p "$STATE_DIR/skipped" for file in ~/.local/share/omarchy/migrations/*.sh; do filename=$(basename "$file") - if [[ ! -f "$STATE_DIR/$filename" && ! -f "$STATE_DIR/skipped/$filename" ]]; then + if [[ ! -f $STATE_DIR/$filename && ! -f $STATE_DIR/skipped/$filename ]]; then echo -e "\e[32m\nRunning migration (${filename%.sh})\e[0m" if bash $file; then diff --git a/bin/omarchy-pkg-aur-install b/bin/omarchy-pkg-aur-install index d1efccf7..02c506b3 100755 --- a/bin/omarchy-pkg-aur-install +++ b/bin/omarchy-pkg-aur-install @@ -18,7 +18,7 @@ fzf_args=( pkg_names=$(yay -Slqa | fzf "${fzf_args[@]}") -if [[ -n "$pkg_names" ]]; then +if [[ -n $pkg_names ]]; then # Add aur/ prefix to each package name and convert to space-separated for yay sudo -v echo "$pkg_names" | sed 's/^/aur\//' | tr '\n' ' ' | xargs yay -S --noconfirm diff --git a/bin/omarchy-pkg-install b/bin/omarchy-pkg-install index 9a964119..09386161 100755 --- a/bin/omarchy-pkg-install +++ b/bin/omarchy-pkg-install @@ -16,7 +16,7 @@ fzf_args=( pkg_names=$(pacman -Slq | fzf "${fzf_args[@]}") -if [[ -n "$pkg_names" ]]; then +if [[ -n $pkg_names ]]; then # Convert newline-separated selections to space-separated for yay echo "$pkg_names" | tr '\n' ' ' | xargs sudo pacman -S --noconfirm omarchy-show-done diff --git a/bin/omarchy-pkg-remove b/bin/omarchy-pkg-remove index aba8d0e3..865c1354 100755 --- a/bin/omarchy-pkg-remove +++ b/bin/omarchy-pkg-remove @@ -16,7 +16,7 @@ fzf_args=( pkg_names=$(yay -Qqe | fzf "${fzf_args[@]}") -if [[ -n "$pkg_names" ]]; then +if [[ -n $pkg_names ]]; then # Convert newline-separated selections to space-separated for yay echo "$pkg_names" | tr '\n' ' ' | xargs sudo pacman -Rns --noconfirm omarchy-show-done diff --git a/bin/omarchy-refresh-chromium b/bin/omarchy-refresh-chromium index ee447b93..e206f363 100755 --- a/bin/omarchy-refresh-chromium +++ b/bin/omarchy-refresh-chromium @@ -6,7 +6,7 @@ CONFIG_FILE="$HOME/.config/chromium-flags.conf" INSTALL_GOOGLE_ACCOUNTS=false # Check if google accounts were installed -if [[ -f "$CONFIG_FILE" ]] && \ +if [[ -f $CONFIG_FILE ]] && \ grep -q -- "--oauth2-client-id" "$CONFIG_FILE" && \ grep -q -- "--oauth2-client-secret" "$CONFIG_FILE"; then INSTALL_GOOGLE_ACCOUNTS=true @@ -16,6 +16,6 @@ fi omarchy-refresh-config chromium-flags.conf # Re-install Google accounts if previously configured -if [[ "$INSTALL_GOOGLE_ACCOUNTS" == true ]]; then +if [[ $INSTALL_GOOGLE_ACCOUNTS == "true" ]]; then omarchy-install-chromium-google-account fi diff --git a/bin/omarchy-refresh-config b/bin/omarchy-refresh-config index f3692429..b293206a 100755 --- a/bin/omarchy-refresh-config +++ b/bin/omarchy-refresh-config @@ -5,7 +5,7 @@ config_file=$1 -if [[ -z "$config_file" ]]; then +if [[ -z $config_file ]]; then cat </dev/null diff --git a/bin/omarchy-refresh-pacman b/bin/omarchy-refresh-pacman index cef14215..f09b44fb 100755 --- a/bin/omarchy-refresh-pacman +++ b/bin/omarchy-refresh-pacman @@ -9,7 +9,7 @@ sudo cp -f /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak channel="${1:-stable}" -if [[ "$channel" != "stable" && "$channel" != "rc" && "$channel" != "edge" ]]; then +if [[ $channel != "stable" && $channel != "rc" && $channel != "edge" ]]; then echo "Error: Invalid channel '$channel'. Must be one of: stable, rc, edge" exit 1 fi diff --git a/bin/omarchy-reinstall-configs b/bin/omarchy-reinstall-configs index d1a99c42..c27b1efa 100755 --- a/bin/omarchy-reinstall-configs +++ b/bin/omarchy-reinstall-configs @@ -3,7 +3,7 @@ set -e # Overwrite all user configs with the Omarchy defaults. -if [ "$EUID" -eq 0 ]; then +if (( EUID == 0 )); then echo "Error: This script should not be run as root" exit 1 fi diff --git a/bin/omarchy-remove-dev-env b/bin/omarchy-remove-dev-env index f851ce42..f25a5ff0 100755 --- a/bin/omarchy-remove-dev-env +++ b/bin/omarchy-remove-dev-env @@ -3,7 +3,7 @@ # Remove a development environment that was previously installed via omarchy-install-dev-env. # Usage: omarchy-remove-dev-env -if [[ -z "$1" ]]; then +if [[ -z $1 ]]; then echo "Usage: omarchy-remove-dev-env " >&2 exit 1 fi diff --git a/bin/omarchy-restart-walker b/bin/omarchy-restart-walker index 2efb9d53..fb1a9eae 100755 --- a/bin/omarchy-restart-walker +++ b/bin/omarchy-restart-walker @@ -12,7 +12,7 @@ restart_services() { fi } -if [[ $EUID -eq 0 ]]; then +if (( EUID == 0 )); then SCRIPT_OWNER=$(stat -c '%U' "$0") USER_UID=$(id -u "$SCRIPT_OWNER") systemd-run --uid="$SCRIPT_OWNER" --setenv=XDG_RUNTIME_DIR="/run/user/$USER_UID" \ diff --git a/bin/omarchy-setup-dns b/bin/omarchy-setup-dns index b72e9458..7a60b641 100755 --- a/bin/omarchy-setup-dns +++ b/bin/omarchy-setup-dns @@ -2,7 +2,7 @@ lock_dns_to_resolved() { for file in /etc/systemd/network/*.network; do - [[ -f "$file" ]] || continue + [[ -f $file ]] || continue if ! grep -q "^\[DHCPv4\]" "$file"; then continue; fi if ! sed -n '/^\[DHCPv4\]/,/^\[/p' "$file" | grep -q "^UseDNS="; then @@ -17,7 +17,7 @@ lock_dns_to_resolved() { unlock_dns_to_dhcp() { for file in /etc/systemd/network/*.network; do - [[ -f "$file" ]] || continue + [[ -f $file ]] || continue sudo sed -i '/^\[DHCPv4\]/{n;/^UseDNS=no$/d}' "$file" sudo sed -i '/^\[IPv6AcceptRA\]/{n;/^UseDNS=no$/d}' "$file" done diff --git a/bin/omarchy-setup-fido2 b/bin/omarchy-setup-fido2 index adb72e31..c042cf2c 100755 --- a/bin/omarchy-setup-fido2 +++ b/bin/omarchy-setup-fido2 @@ -21,7 +21,7 @@ print_info() { check_fido2_hardware() { tokens=$(fido2-token -L 2>/dev/null) - if [ -z "$tokens" ]; then + if [[ -z $tokens ]]; then print_error "\nNo FIDO2 device detected. Please plug it in (you may need to unlock it as well)." return 1 fi @@ -36,10 +36,10 @@ setup_pam_config() { fi # Configure polkit - if [ -f /etc/pam.d/polkit-1 ] && ! grep -q 'pam_u2f.so' /etc/pam.d/polkit-1; then + if [[ -f /etc/pam.d/polkit-1 ]] && ! grep -q 'pam_u2f.so' /etc/pam.d/polkit-1; then print_info "Configuring polkit for FIDO2 authentication..." sudo sed -i '1i auth sufficient pam_u2f.so cue authfile=/etc/fido2/fido2' /etc/pam.d/polkit-1 - elif [ ! -f /etc/pam.d/polkit-1 ]; then + elif [[ ! -f /etc/pam.d/polkit-1 ]]; then print_info "Creating polkit configuration with FIDO2 authentication..." sudo tee /etc/pam.d/polkit-1 >/dev/null <<'EOF' auth sufficient pam_u2f.so cue authfile=/etc/fido2/fido2 @@ -60,20 +60,20 @@ remove_pam_config() { fi # Remove from polkit - if [ -f /etc/pam.d/polkit-1 ] && grep -Fq 'pam_u2f.so' /etc/pam.d/polkit-1; then + if [[ -f /etc/pam.d/polkit-1 ]] && grep -Fq 'pam_u2f.so' /etc/pam.d/polkit-1; then print_info "Removing FIDO2 authentication from polkit..." sudo sed -i '/pam_u2f\.so/d' /etc/pam.d/polkit-1 fi } -if [[ "--remove" == "$1" ]]; then +if [[ "--remove" == $1 ]]; then print_success "Removing FIDO2 device from authentication.\n" # Remove PAM configuration remove_pam_config # Remove FIDO2 configuration - if [ -d /etc/fido2 ]; then + if [[ -d /etc/fido2 ]]; then print_info "Removing FIDO2 configuration..." sudo rm -rf /etc/fido2 fi @@ -95,7 +95,7 @@ else fi # Create the pamu2fcfg file - if [ ! -f /etc/fido2/fido2 ]; then + if [[ ! -f /etc/fido2/fido2 ]]; then sudo mkdir -p /etc/fido2 print_success "\nLet's setup your device by confirming on the device now." print_info "Touch your FIDO2 key when it lights up...\n" diff --git a/bin/omarchy-setup-fingerprint b/bin/omarchy-setup-fingerprint index 7a746e56..42149651 100755 --- a/bin/omarchy-setup-fingerprint +++ b/bin/omarchy-setup-fingerprint @@ -24,7 +24,7 @@ check_fingerprint_hardware() { devices=$(fprintd-list "$USER" 2>/dev/null) # Exit if no devices found - if [[ -z "$devices" ]]; then + if [[ -z $devices ]]; then print_error "\nNo fingerprint sensor detected." return 1 fi @@ -39,10 +39,10 @@ setup_pam_config() { fi # Configure polkit - if [ -f /etc/pam.d/polkit-1 ] && ! grep -q 'pam_fprintd.so' /etc/pam.d/polkit-1; then + if [[ -f /etc/pam.d/polkit-1 ]] && ! grep -q 'pam_fprintd.so' /etc/pam.d/polkit-1; then print_info "Configuring polkit for fingerprint authentication..." sudo sed -i '1i auth sufficient pam_fprintd.so' /etc/pam.d/polkit-1 - elif [ ! -f /etc/pam.d/polkit-1 ]; then + elif [[ ! -f /etc/pam.d/polkit-1 ]]; then print_info "Creating polkit configuration with fingerprint authentication..." sudo tee /etc/pam.d/polkit-1 >/dev/null <<'EOF' auth sufficient pam_fprintd.so @@ -75,13 +75,13 @@ remove_pam_config() { fi # Remove from polkit - if [ -f /etc/pam.d/polkit-1 ] && grep -Fq 'pam_fprintd.so' /etc/pam.d/polkit-1; then + if [[ -f /etc/pam.d/polkit-1 ]] && grep -Fq 'pam_fprintd.so' /etc/pam.d/polkit-1; then print_info "Removing fingerprint authentication from polkit..." sudo sed -i '/pam_fprintd\.so/d' /etc/pam.d/polkit-1 fi } -if [[ "--remove" == "$1" ]]; then +if [[ "--remove" == $1 ]]; then print_success "Removing fingerprint scanner from authentication.\n" # Remove PAM configuration diff --git a/bin/omarchy-state b/bin/omarchy-state index 884b6d94..ff5e3e87 100755 --- a/bin/omarchy-state +++ b/bin/omarchy-state @@ -10,12 +10,12 @@ mkdir -p "$STATE_DIR" COMMAND="$1" STATE_NAME="$2" -if [[ -z "$COMMAND" ]]; then +if [[ -z $COMMAND ]]; then echo "Usage: omarchy-state " exit 1 fi -if [[ -z "$STATE_NAME" ]]; then +if [[ -z $STATE_NAME ]]; then echo "Usage: omarchy-state $COMMAND " exit 1 fi diff --git a/bin/omarchy-swayosd-brightness b/bin/omarchy-swayosd-brightness index 697be162..1fb492a1 100755 --- a/bin/omarchy-swayosd-brightness +++ b/bin/omarchy-swayosd-brightness @@ -6,7 +6,7 @@ percent="$1" progress="$(awk -v p="$percent" 'BEGIN{printf "%.2f", p/100}')" -[[ "$progress" == "0.00" ]] && progress="0.01" +[[ $progress == "0.00" ]] && progress="0.01" swayosd-client \ --monitor "$(hyprctl monitors -j | jq -r '.[]|select(.focused==true).name')" \ diff --git a/bin/omarchy-swayosd-kbd-brightness b/bin/omarchy-swayosd-kbd-brightness index 7102b561..4c0a30bb 100755 --- a/bin/omarchy-swayosd-kbd-brightness +++ b/bin/omarchy-swayosd-kbd-brightness @@ -6,7 +6,7 @@ percent="$1" progress="$(awk -v p="$percent" 'BEGIN{printf "%.2f", p/100}')" -[[ "$progress" == "0.00" ]] && progress="0.01" +[[ $progress == "0.00" ]] && progress="0.01" swayosd-client \ --monitor "$(hyprctl monitors -j | jq -r '.[]|select(.focused==true).name')" \ diff --git a/bin/omarchy-theme-bg-next b/bin/omarchy-theme-bg-next index e073db5c..42f15340 100755 --- a/bin/omarchy-theme-bg-next +++ b/bin/omarchy-theme-bg-next @@ -10,13 +10,13 @@ CURRENT_BACKGROUND_LINK="$HOME/.config/omarchy/current/background" mapfile -d '' -t BACKGROUNDS < <(find -L "$USER_BACKGROUNDS_PATH" "$THEME_BACKGROUNDS_PATH" -maxdepth 1 -type f -print0 2>/dev/null | sort -z) TOTAL=${#BACKGROUNDS[@]} -if [[ $TOTAL -eq 0 ]]; then +if (( TOTAL == 0 )); then notify-send "No background was found for theme" -t 2000 pkill -x swaybg setsid uwsm-app -- swaybg --color '#000000' >/dev/null 2>&1 & else # Get current background from symlink - if [[ -L "$CURRENT_BACKGROUND_LINK" ]]; then + if [[ -L $CURRENT_BACKGROUND_LINK ]]; then CURRENT_BACKGROUND=$(readlink "$CURRENT_BACKGROUND_LINK") else # Default to first background if no symlink exists @@ -26,14 +26,14 @@ else # Find current background index INDEX=-1 for i in "${!BACKGROUNDS[@]}"; do - if [[ "${BACKGROUNDS[$i]}" == "$CURRENT_BACKGROUND" ]]; then + if [[ ${BACKGROUNDS[$i]} == $CURRENT_BACKGROUND ]]; then INDEX=$i break fi done # Get next background (wrap around) - if [[ $INDEX -eq -1 ]]; then + if (( INDEX == -1 )); then # Use the first background when no match was found NEW_BACKGROUND="${BACKGROUNDS[0]}" else diff --git a/bin/omarchy-theme-bg-set b/bin/omarchy-theme-bg-set index 0b13ef0b..45992612 100755 --- a/bin/omarchy-theme-bg-set +++ b/bin/omarchy-theme-bg-set @@ -2,7 +2,7 @@ # Sets the specified image as the current background -if [[ -z "$1" ]]; then +if [[ -z $1 ]]; then echo "Usage: omarchy-theme-bg-set " >&2 exit 1 fi diff --git a/bin/omarchy-theme-install b/bin/omarchy-theme-install index bc9001e7..0c0f0c4e 100755 --- a/bin/omarchy-theme-install +++ b/bin/omarchy-theme-install @@ -3,14 +3,14 @@ # omarchy-theme-install: Install a new theme from a git repo for Omarchy # Usage: omarchy-theme-install -if [ -z "$1" ]; then +if [[ -z $1 ]]; then echo -e "\e[32mSee https://manuals.omamix.org/2/the-omarchy-manual/90/extra-themes\n\e[0m" REPO_URL=$(gum input --placeholder="Git repo URL for theme" --header="") else REPO_URL="$1" fi -if [ -z "$REPO_URL" ]; then +if [[ -z $REPO_URL ]]; then exit 1 fi @@ -19,7 +19,7 @@ THEME_NAME=$(basename "$REPO_URL" .git | sed -E 's/^omarchy-//; s/-theme$//') THEME_PATH="$THEMES_DIR/$THEME_NAME" # Remove existing theme if present -if [ -d "$THEME_PATH" ]; then +if [[ -d $THEME_PATH ]]; then rm -rf "$THEME_PATH" fi diff --git a/bin/omarchy-theme-remove b/bin/omarchy-theme-remove index ee51d809..98a81fa0 100755 --- a/bin/omarchy-theme-remove +++ b/bin/omarchy-theme-remove @@ -3,10 +3,10 @@ # omarchy-theme-remove: Remove a theme from Omarchy by name # Usage: omarchy-theme-remove -if [ -z "$1" ]; then +if [[ -z $1 ]]; then mapfile -t extra_themes < <(find ~/.config/omarchy/themes -mindepth 1 -maxdepth 1 -type d ! -xtype l -printf '%f\n') - if [[ ${#extra_themes[@]} -gt 0 ]]; then + if (( ${#extra_themes[@]} > 0 )); then THEME_NAME=$(printf '%s\n' "${extra_themes[@]}" | sort | gum choose --header="Remove extra theme") else echo "No extra themes installed." @@ -21,12 +21,12 @@ CURRENT_DIR="$HOME/.config/omarchy/current" THEME_PATH="$THEMES_DIR/$THEME_NAME" # Ensure a theme was set -if [ -z "$THEME_NAME" ]; then +if [[ -z $THEME_NAME ]]; then exit 1 fi # Check if theme exists before attempting removal -if [ ! -d "$THEME_PATH" ]; then +if [[ ! -d $THEME_PATH ]]; then echo "Error: Theme '$THEME_NAME' not found." exit 1 fi diff --git a/bin/omarchy-theme-set b/bin/omarchy-theme-set index 6fb2dddd..0c57455b 100755 --- a/bin/omarchy-theme-set +++ b/bin/omarchy-theme-set @@ -12,7 +12,7 @@ OMARCHY_THEMES_PATH="$OMARCHY_PATH/themes" THEME_NAME=$(echo "$1" | sed -E 's/<[^>]+>//g' | tr '[:upper:]' '[:lower:]' | tr ' ' '-') -if [[ ! -d "$OMARCHY_THEMES_PATH/$THEME_NAME" ]] && [[ ! -d "$USER_THEMES_PATH/$THEME_NAME" ]]; then +if [[ ! -d $OMARCHY_THEMES_PATH/$THEME_NAME ]] && [[ ! -d $USER_THEMES_PATH/$THEME_NAME ]]; then echo "Theme '$THEME_NAME' does not exist" exit 1 fi diff --git a/bin/omarchy-theme-set-keyboard-f16 b/bin/omarchy-theme-set-keyboard-f16 index c7a352da..1a30991e 100755 --- a/bin/omarchy-theme-set-keyboard-f16 +++ b/bin/omarchy-theme-set-keyboard-f16 @@ -2,7 +2,7 @@ FRAMEWORK16_THEME=~/.config/omarchy/current/theme/keyboard.rgb -if omarchy-cmd-present qmk_hid && [[ -f "$FRAMEWORK16_THEME" ]]; then +if omarchy-cmd-present qmk_hid && [[ -f $FRAMEWORK16_THEME ]]; then hex=$(cat "$FRAMEWORK16_THEME") hex="${hex#\#}" diff --git a/bin/omarchy-theme-set-obsidian b/bin/omarchy-theme-set-obsidian index f86cea1d..420bd8c3 100755 --- a/bin/omarchy-theme-set-obsidian +++ b/bin/omarchy-theme-set-obsidian @@ -4,15 +4,15 @@ CURRENT_THEME_DIR="$HOME/.config/omarchy/current/theme" -[ -f "$CURRENT_THEME_DIR/obsidian.css" ] || exit 0 +[[ -f $CURRENT_THEME_DIR/obsidian.css ]] || exit 0 jq -r '.vaults | values[].path' ~/.config/obsidian/obsidian.json 2>/dev/null | while read -r vault_path; do - [ -d "$vault_path/.obsidian" ] || continue + [[ -d $vault_path/.obsidian ]] || continue theme_dir="$vault_path/.obsidian/themes/Omarchy" mkdir -p "$theme_dir" - [ -f "$theme_dir/manifest.json" ] || cat >"$theme_dir/manifest.json" <<'EOF' + [[ -f $theme_dir/manifest.json ]] || cat >"$theme_dir/manifest.json" <<'EOF' { "name": "Omarchy", "version": "1.0.0", diff --git a/bin/omarchy-theme-set-vscode b/bin/omarchy-theme-set-vscode index bf53013b..3980f68d 100755 --- a/bin/omarchy-theme-set-vscode +++ b/bin/omarchy-theme-set-vscode @@ -9,18 +9,18 @@ set_theme() { local settings_path="$2" local skip_flag="$3" - omarchy-cmd-present "$editor_cmd" && [[ ! -f "$skip_flag" ]] || return 0 + omarchy-cmd-present "$editor_cmd" && [[ ! -f $skip_flag ]] || return 0 - if [[ -f "$VS_CODE_THEME" ]]; then + if [[ -f $VS_CODE_THEME ]]; then theme_name=$(jq -r '.name' "$VS_CODE_THEME") extension=$(jq -r '.extension' "$VS_CODE_THEME") - if [[ -n "$extension" ]] && ! "$editor_cmd" --list-extensions | grep -Fxq "$extension"; then + if [[ -n $extension ]] && ! "$editor_cmd" --list-extensions | grep -Fxq "$extension"; then "$editor_cmd" --install-extension "$extension" >/dev/null fi mkdir -p "$(dirname "$settings_path")" - [[ -f "$settings_path" ]] || printf '{\n}\n' >"$settings_path" + [[ -f $settings_path ]] || printf '{\n}\n' >"$settings_path" if ! grep -q '"workbench.colorTheme"' "$settings_path"; then sed -i --follow-symlinks -E '0,/\{/{s/\{/{\ "workbench.colorTheme": "",/}' "$settings_path" @@ -29,7 +29,7 @@ set_theme() { sed -i --follow-symlinks -E \ "s/(\"workbench.colorTheme\"[[:space:]]*:[[:space:]]*\")[^\"]*(\")/\1$theme_name\2/" \ "$settings_path" - elif [[ -f "$settings_path" ]]; then + elif [[ -f $settings_path ]]; then sed -i --follow-symlinks -E 's/\"workbench\.colorTheme\"[[:space:]]*:[^,}]*,?//' "$settings_path" fi } diff --git a/bin/omarchy-theme-update b/bin/omarchy-theme-update index aa68f095..cfb823f4 100755 --- a/bin/omarchy-theme-update +++ b/bin/omarchy-theme-update @@ -1,7 +1,7 @@ #!/bin/bash for dir in ~/.config/omarchy/themes/*/; do - if [[ -d $dir ]] && [[ ! -L "${dir%/}" ]] && [[ -d "$dir/.git" ]]; then + if [[ -d $dir ]] && [[ ! -L ${dir%/} ]] && [[ -d $dir/.git ]]; then echo "Updating: $(basename "$dir")" git -C "$dir" pull fi diff --git a/bin/omarchy-toggle-nightlight b/bin/omarchy-toggle-nightlight index 99b0286b..cb0836ee 100755 --- a/bin/omarchy-toggle-nightlight +++ b/bin/omarchy-toggle-nightlight @@ -19,7 +19,7 @@ restart_nightlighted_waybar() { fi } -if [[ "$CURRENT_TEMP" == "$OFF_TEMP" ]]; then +if [[ $CURRENT_TEMP == $OFF_TEMP ]]; then hyprctl hyprsunset temperature $ON_TEMP notify-send " Nightlight screen temperature" restart_nightlighted_waybar diff --git a/bin/omarchy-toggle-single-window-square-aspect b/bin/omarchy-toggle-single-window-square-aspect index e19b1aba..423ef0d1 100755 --- a/bin/omarchy-toggle-single-window-square-aspect +++ b/bin/omarchy-toggle-single-window-square-aspect @@ -4,7 +4,7 @@ CURRENT_VALUE=$(hyprctl getoption "dwindle:single_window_aspect_ratio" 2>/dev/null | head -1) # Parse vec2 output: "vec2: [1, 1]" or "vec2: [0, 0]" -if [[ "$CURRENT_VALUE" == *"[1, 1]"* ]]; then +if [[ $CURRENT_VALUE == *"[1, 1]"* ]]; then hyprctl keyword dwindle:single_window_aspect_ratio "0 0" notify-send " Disable single-window square aspect ratio" else diff --git a/bin/omarchy-tui-install b/bin/omarchy-tui-install index ebd3dfa1..2d6397a2 100755 --- a/bin/omarchy-tui-install +++ b/bin/omarchy-tui-install @@ -2,7 +2,7 @@ set -e -if [ "$#" -ne 4 ]; then +if (( $# != 4 )); then echo -e "\e[32mLet's create a TUI shortcut you can start with the app launcher.\n\e[0m" APP_NAME=$(gum input --prompt "Name> " --placeholder "My TUI") APP_EXEC=$(gum input --prompt "Launch Command> " --placeholder "lazydocker or bash -c 'dust; read -n 1 -s'") @@ -15,7 +15,7 @@ else ICON_URL="$4" fi -if [[ -z "$APP_NAME" || -z "$APP_EXEC" || -z "$ICON_URL" ]]; then +if [[ -z $APP_NAME || -z $APP_EXEC || -z $ICON_URL ]]; then echo "You must set app name, app command, and icon URL!" exit 1 fi @@ -23,7 +23,7 @@ fi ICON_DIR="$HOME/.local/share/applications/icons" DESKTOP_FILE="$HOME/.local/share/applications/$APP_NAME.desktop" -if [[ ! "$ICON_URL" =~ ^https?:// ]] && [ -f "$ICON_URL" ]; then +if [[ ! $ICON_URL =~ ^https?:// ]] && [[ -f $ICON_URL ]]; then ICON_PATH="$ICON_URL" else ICON_PATH="$ICON_DIR/$APP_NAME.png" @@ -54,6 +54,6 @@ EOF chmod +x "$DESKTOP_FILE" -if [ "$#" -ne 4 ]; then +if (( $# != 4 )); then echo -e "You can now find $APP_NAME using the app launcher (SUPER + SPACE)\n" fi diff --git a/bin/omarchy-tui-remove b/bin/omarchy-tui-remove index e436776b..3b97df8c 100755 --- a/bin/omarchy-tui-remove +++ b/bin/omarchy-tui-remove @@ -5,7 +5,7 @@ set -e ICON_DIR="$HOME/.local/share/applications/icons" DESKTOP_DIR="$HOME/.local/share/applications/" -if [ "$#" -eq 0 ]; then +if (( $# == 0 )); then # Find all TUIs while IFS= read -r -d '' file; do if grep -qE '^Exec=.*(\$TERMINAL|xdg-terminal-exec).*-e' "$file"; then @@ -20,7 +20,7 @@ if [ "$#" -eq 0 ]; then # Convert newline-separated string to array APP_NAMES=() while IFS= read -r line; do - [[ -n "$line" ]] && APP_NAMES+=("$line") + [[ -n $line ]] && APP_NAMES+=("$line") done <<< "$APP_NAMES_STRING" else echo "No TUIs to remove." @@ -31,7 +31,7 @@ else APP_NAMES=("$@") fi -if [[ ${#APP_NAMES[@]} -eq 0 ]]; then +if (( ${#APP_NAMES[@]} == 0 )); then echo "You must provide TUI names." exit 1 fi diff --git a/bin/omarchy-tui-remove-all b/bin/omarchy-tui-remove-all index 8a696d84..8efe4d80 100755 --- a/bin/omarchy-tui-remove-all +++ b/bin/omarchy-tui-remove-all @@ -17,7 +17,7 @@ while IFS= read -r -d '' file; do fi done < <(find "$APP_DIR" -maxdepth 1 -name "*.desktop" -print0 2>/dev/null) -if [[ ${#tui_desktop_files[@]} -eq 0 ]]; then +if (( ${#tui_desktop_files[@]} == 0 )); then echo "No TUIs found." exit 0 fi diff --git a/bin/omarchy-update b/bin/omarchy-update index 7b800005..086e78c9 100755 --- a/bin/omarchy-update +++ b/bin/omarchy-update @@ -5,7 +5,7 @@ set -e trap 'echo ""; echo -e "\033[0;31mSomething went wrong during the update!\n\nPlease review the output above carefully, correct the error, and retry the update.\n\nIf you need assistance, get help from the community at https://omarchy.org/discord\033[0m"' ERR if [[ $1 == "-y" ]] || omarchy-update-confirm; then - omarchy-snapshot create || [ $? -eq 127 ] + omarchy-snapshot create || (( $? == 127 )) omarchy-update-git omarchy-update-perform fi diff --git a/bin/omarchy-update-available b/bin/omarchy-update-available index 25558215..e5d19cf7 100755 --- a/bin/omarchy-update-available +++ b/bin/omarchy-update-available @@ -2,19 +2,19 @@ # Get remote tag latest_tag=$(git -C "$OMARCHY_PATH" ls-remote --tags origin | grep -v "{}" | awk '{print $2}' | sed 's#refs/tags/##' | sort -V | tail -n 1) -if [[ -z "$latest_tag" ]]; then +if [[ -z $latest_tag ]]; then echo "Error: Could not retrieve latest tag." exit 1 fi # Get local tag current_tag=$(git -C "$OMARCHY_PATH" describe --tags $(git -C "$OMARCHY_PATH" rev-list --tags --max-count=1)) -if [[ -z "$current_tag" ]]; then +if [[ -z $current_tag ]]; then echo "Error: Could not retrieve current tag." exit 1 fi -if [[ "$current_tag" != "$latest_tag" ]]; then +if [[ $current_tag != $latest_tag ]]; then echo "Omarchy update available ($latest_tag)" exit 0 else diff --git a/bin/omarchy-update-branch b/bin/omarchy-update-branch index 91bd797e..b10822cd 100755 --- a/bin/omarchy-update-branch +++ b/bin/omarchy-update-branch @@ -10,7 +10,7 @@ fi branch="$1" # Snapshot before switching branch -omarchy-snapshot create || [ $? -eq 127 ] +omarchy-snapshot create || (( $? == 127 )) if ! git -C "$OMARCHY_PATH" diff --quiet || ! git -C "$OMARCHY_PATH" diff --cached --quiet; then stashed=true @@ -23,7 +23,7 @@ fi git -C "$OMARCHY_PATH" switch "$branch" # Reapply stash if we made one -if [[ $stashed == true ]]; then +if [[ $stashed == "true" ]]; then if ! git -C "$OMARCHY_PATH" stash pop; then echo "⚠️ Conflicts when applying stash — stash kept" fi diff --git a/bin/omarchy-update-restart b/bin/omarchy-update-restart index 2121d279..3ed79776 100755 --- a/bin/omarchy-update-restart +++ b/bin/omarchy-update-restart @@ -1,13 +1,13 @@ #!/bin/bash -if [ ! -d "/usr/lib/modules/$(uname -r)" ]; then +if [[ ! -d /usr/lib/modules/$(uname -r) ]]; then gum confirm "Linux kernel has been updated. Reboot?" && omarchy-cmd-reboot -elif [ -f "$HOME/.local/state/omarchy/reboot-required" ]; then +elif [[ -f $HOME/.local/state/omarchy/reboot-required ]]; then gum confirm "Updates require reboot. Ready?" && omarchy-cmd-reboot fi for file in "$HOME"/.local/state/omarchy/restart-*-required; do - if [ -f "$file" ]; then + if [[ -f $file ]]; then filename=$(basename "$file") service=$(echo "$filename" | sed 's/restart-\(.*\)-required/\1/') echo "Restarting $service" diff --git a/bin/omarchy-upload-log b/bin/omarchy-upload-log index acd4bbaa..c084f518 100755 --- a/bin/omarchy-upload-log +++ b/bin/omarchy-upload-log @@ -46,7 +46,7 @@ install) cat "$SYSTEM_INFO" >"$TEMP_LOG" cat $ARCHINSTALL_LOG $OMARCHY_LOG >>"$TEMP_LOG" 2>/dev/null - if [ ! -s "$TEMP_LOG" ]; then + if [[ ! -s $TEMP_LOG ]]; then echo "Error: No install logs found" exit 1 fi @@ -59,7 +59,7 @@ this-boot) cat "$SYSTEM_INFO" >"$TEMP_LOG" journalctl -b 0 >>"$TEMP_LOG" 2>/dev/null - if [ ! -s "$TEMP_LOG" ]; then + if [[ ! -s $TEMP_LOG ]]; then echo "Error: No logs found for current boot" exit 1 fi @@ -72,7 +72,7 @@ last-boot) cat "$SYSTEM_INFO" >"$TEMP_LOG" journalctl -b -1 >>"$TEMP_LOG" 2>/dev/null - if [ ! -s "$TEMP_LOG" ]; then + if [[ ! -s $TEMP_LOG ]]; then echo "Error: No logs found for previous boot" exit 1 fi @@ -91,7 +91,7 @@ installed|system-info) pacman -Q 2>/dev/null || echo "Failed to get package list" } >>"$TEMP_LOG" - if [ ! -s "$TEMP_LOG" ]; then + if [[ ! -s $TEMP_LOG ]]; then echo "Error: Failed to gather system information" exit 1 fi @@ -113,7 +113,7 @@ echo "" URL=$(curl -sF "file=@$TEMP_LOG" -Fexpires=24 https://0x0.st) -if [ $? -eq 0 ] && [ -n "$URL" ]; then +if (( $? == 0 )) && [[ -n $URL ]]; then echo "✓ Log uploaded successfully!" echo "Share this URL:" echo "" diff --git a/bin/omarchy-webapp-install b/bin/omarchy-webapp-install index 943d0b70..264c7ea9 100755 --- a/bin/omarchy-webapp-install +++ b/bin/omarchy-webapp-install @@ -4,7 +4,7 @@ set -e ICON_DIR="$HOME/.local/share/applications/icons" -if [[ $# -lt 3 ]]; then +if (( $# < 3 )); then echo -e "\e[32mLet's create a new web app you can start with the app launcher.\n\e[0m" APP_NAME=$(gum input --prompt "Name> " --placeholder "My favorite web app") APP_URL=$(gum input --prompt "URL> " --placeholder "https://example.com") @@ -84,6 +84,6 @@ fi chmod +x "$DESKTOP_FILE" -if [[ $INTERACTIVE_MODE == true ]]; then +if [[ $INTERACTIVE_MODE == "true" ]]; then echo -e "You can now find $APP_NAME using the app launcher (SUPER + SPACE)\n" fi diff --git a/bin/omarchy-webapp-remove b/bin/omarchy-webapp-remove index 2da36b54..a54aba5c 100755 --- a/bin/omarchy-webapp-remove +++ b/bin/omarchy-webapp-remove @@ -5,7 +5,7 @@ set -e ICON_DIR="$HOME/.local/share/applications/icons" DESKTOP_DIR="$HOME/.local/share/applications/" -if [ "$#" -eq 0 ]; then +if (( $# == 0 )); then # Find all web apps while IFS= read -r -d '' file; do if grep -q '^Exec=.*\(omarchy-launch-webapp\|omarchy-webapp-handler\).*' "$file"; then @@ -20,7 +20,7 @@ if [ "$#" -eq 0 ]; then # Convert newline-separated string to array APP_NAMES=() while IFS= read -r line; do - [[ -n "$line" ]] && APP_NAMES+=("$line") + [[ -n $line ]] && APP_NAMES+=("$line") done <<< "$APP_NAMES_STRING" else echo "No web apps to remove." @@ -31,7 +31,7 @@ else APP_NAMES=("$@") fi -if [[ ${#APP_NAMES[@]} -eq 0 ]]; then +if (( ${#APP_NAMES[@]} == 0 )); then echo "You must select at least one web app to remove." exit 1 fi diff --git a/bin/omarchy-webapp-remove-all b/bin/omarchy-webapp-remove-all index 9cb8f4e3..d2006abc 100755 --- a/bin/omarchy-webapp-remove-all +++ b/bin/omarchy-webapp-remove-all @@ -17,7 +17,7 @@ while IFS= read -r -d '' file; do fi done < <(find "$APP_DIR" -maxdepth 1 -name "*.desktop" -print0 2>/dev/null) -if [[ ${#webapp_desktop_files[@]} -eq 0 ]]; then +if (( ${#webapp_desktop_files[@]} == 0 )); then echo "No web apps found." exit 0 fi diff --git a/bin/omarchy-windows-vm b/bin/omarchy-windows-vm index e257ebe0..70386213 100755 --- a/bin/omarchy-windows-vm +++ b/bin/omarchy-windows-vm @@ -6,7 +6,7 @@ check_prerequisites() { local REQUIRED_SPACE=$((DISK_SIZE_GB + 10)) # Add 10GB for Windows ISO and overhead # Check for KVM support - if [ ! -e /dev/kvm ]; then + if [[ ! -e /dev/kvm ]]; then gum style \ --border normal \ --padding "1 2" \ @@ -21,7 +21,7 @@ check_prerequisites() { # Check disk space AVAILABLE_SPACE=$(df "$HOME" | awk 'NR==2 {print int($4/1024/1024)}') - if [ "$AVAILABLE_SPACE" -lt "$REQUIRED_SPACE" ]; then + if (( AVAILABLE_SPACE < REQUIRED_SPACE )); then echo "❌ Insufficient disk space!" echo " Available: ${AVAILABLE_SPACE}GB" echo " Required: ${REQUIRED_SPACE}GB (${DISK_SIZE_GB}GB disk + 10GB for Windows image)" @@ -42,7 +42,7 @@ install_windows() { mkdir -p "$HOME/.local/share/applications/icons" # Install Windows VM icon and desktop file - if [ -f "$OMARCHY_PATH/applications/icons/windows.png" ]; then + if [[ -f $OMARCHY_PATH/applications/icons/windows.png ]]; then cp "$OMARCHY_PATH/applications/icons/windows.png" "$HOME/.local/share/applications/icons/windows.png" fi @@ -70,7 +70,7 @@ EOF RAM_OPTIONS="" for size in 2 4 8 16 32 64; do - if [ $size -le $TOTAL_RAM_GB ]; then + if (( size <= TOTAL_RAM_GB )); then RAM_OPTIONS="$RAM_OPTIONS ${size}G" fi done @@ -78,7 +78,7 @@ EOF SELECTED_RAM=$(echo $RAM_OPTIONS | tr ' ' '\n' | gum choose --selected="4G" --header="How much RAM would you like to allocate to Windows VM?") # Check if user cancelled - if [ -z "$SELECTED_RAM" ]; then + if [[ -z $SELECTED_RAM ]]; then echo "Installation cancelled by user" exit 1 fi @@ -86,12 +86,12 @@ EOF SELECTED_CORES=$(gum input --placeholder="Number of CPU cores (1-$TOTAL_CORES)" --value="2" --header="How many CPU cores would you like to allocate to Windows VM?" --char-limit=2) # Check if user cancelled (Ctrl+C in gum input returns empty string) - if [ -z "$SELECTED_CORES" ]; then + if [[ -z $SELECTED_CORES ]]; then echo "Installation cancelled by user" exit 1 fi - if ! [[ "$SELECTED_CORES" =~ ^[0-9]+$ ]] || [ "$SELECTED_CORES" -lt 1 ] || [ "$SELECTED_CORES" -gt "$TOTAL_CORES" ]; then + if ! [[ $SELECTED_CORES =~ ^[0-9]+$ ]] || (( SELECTED_CORES < 1 )) || (( SELECTED_CORES > TOTAL_CORES )); then echo "Invalid input. Using default: 2 cores" SELECTED_CORES=2 fi @@ -100,7 +100,7 @@ EOF MAX_DISK_GB=$((AVAILABLE_SPACE - 10)) # Leave 10GB for Windows image # Check if we have enough space for minimum - if [ $MAX_DISK_GB -lt 32 ]; then + if (( MAX_DISK_GB < 32 )); then echo "❌ Insufficient disk space for Windows VM!" echo " Available: ${AVAILABLE_SPACE}GB" echo " Minimum required: 42GB (32GB disk + 10GB for Windows image)" @@ -109,7 +109,7 @@ EOF DISK_OPTIONS="" for size in 32 64 128 256 512; do - if [ $size -le $MAX_DISK_GB ]; then + if (( size <= MAX_DISK_GB )); then DISK_OPTIONS="$DISK_OPTIONS ${size}G" fi done @@ -123,7 +123,7 @@ EOF SELECTED_DISK=$(echo $DISK_OPTIONS | tr ' ' '\n' | gum choose --selected="$DEFAULT_DISK" --header="How much disk space would you like to give Windows VM? (64GB+ recommended)") # Check if user cancelled - if [ -z "$SELECTED_DISK" ]; then + if [[ -z $SELECTED_DISK ]]; then echo "Installation cancelled by user" exit 1 fi @@ -136,12 +136,12 @@ EOF # Prompt for username and password USERNAME=$(gum input --placeholder="Username (Press enter to use default: docker)" --header="Enter Windows username:") - if [ -z "$USERNAME" ]; then + if [[ -z $USERNAME ]]; then USERNAME="docker" fi PASSWORD=$(gum input --placeholder="Password (Press enter to use default: admin)" --password --header="Enter Windows password:") - if [ -z "$PASSWORD" ]; then + if [[ -z $PASSWORD ]]; then PASSWORD="admin" PASSWORD_DISPLAY="(default)" else @@ -263,12 +263,12 @@ remove_windows() { launch_windows() { KEEP_ALIVE=false - if [ "$1" = "--keep-alive" ] || [ "$1" = "-k" ]; then + if [[ $1 = "--keep-alive" ]] || [[ $1 = "-k" ]]; then KEEP_ALIVE=true fi # Check if config exists - if [ ! -f "$COMPOSE_FILE" ]; then + if [[ ! -f $COMPOSE_FILE ]]; then echo "Windows VM not configured. Please run: omarchy-windows-vm install" exit 1 fi @@ -278,13 +278,13 @@ launch_windows() { WIN_PASS=$(grep "PASSWORD:" "$COMPOSE_FILE" | sed 's/.*PASSWORD: "\(.*\)"/\1/') # Use defaults if not found - [ -z "$WIN_USER" ] && WIN_USER="docker" - [ -z "$WIN_PASS" ] && WIN_PASS="admin" + [[ -z $WIN_USER ]] && WIN_USER="docker" + [[ -z $WIN_PASS ]] && WIN_PASS="admin" # Check if container is already running CONTAINER_STATUS=$(docker inspect --format='{{.State.Status}}' omarchy-windows 2>/dev/null) - if [ "$CONTAINER_STATUS" != "running" ]; then + if [[ $CONTAINER_STATUS != "running" ]]; then echo "Starting Windows VM..." # Send desktop notification @@ -303,7 +303,7 @@ launch_windows() { until docker logs omarchy-windows 2>&1 | grep -qi "windows started successfully"; do sleep 2 WAIT_COUNT=$((WAIT_COUNT + 1)) - if [ $WAIT_COUNT -gt 60 ]; then # 2 minutes timeout + if (( WAIT_COUNT > 60 )); then # 2 minutes timeout echo "" echo "❌ Timeout: Windows VM failed to start within 2 minutes" echo " Check logs: docker logs omarchy-windows" @@ -313,7 +313,7 @@ launch_windows() { fi # Build the connection info - if [ "$KEEP_ALIVE" = true ]; then + if [[ $KEEP_ALIVE = "true" ]]; then LIFECYCLE="VM will keep running after RDP closes To stop: omarchy-windows-vm stop" else @@ -334,9 +334,9 @@ To stop: omarchy-windows-vm stop" SCALE_PERCENT=$(echo "$HYPR_SCALE" | awk '{print int($1 * 100)}') RDP_SCALE="" - if [ "$SCALE_PERCENT" -ge 170 ]; then + if (( SCALE_PERCENT >= 170 )); then RDP_SCALE="/scale:180" - elif [ "$SCALE_PERCENT" -ge 130 ]; then + elif (( SCALE_PERCENT >= 130 )); then RDP_SCALE="/scale:140" fi # If scale is less than 130%, don't set any scale (use default 100) @@ -345,7 +345,7 @@ To stop: omarchy-windows-vm stop" xfreerdp3 /u:"$WIN_USER" /p:"$WIN_PASS" /v:127.0.0.1:3389 -grab-keyboard /sound /microphone /clipboard /cert:ignore /title:"Windows VM - Omarchy" /dynamic-resolution /gfx:AVC444 /floatbar:sticky:off,default:visible,show:fullscreen $RDP_SCALE # After RDP closes, stop the container unless --keep-alive was specified - if [ "$KEEP_ALIVE" = false ]; then + if [[ $KEEP_ALIVE = "false" ]]; then echo "" echo "RDP session closed. Stopping Windows VM..." docker-compose -f "$COMPOSE_FILE" down @@ -358,7 +358,7 @@ To stop: omarchy-windows-vm stop" } stop_windows() { - if [ ! -f "$COMPOSE_FILE" ]; then + if [[ ! -f $COMPOSE_FILE ]]; then echo "Windows VM not configured." exit 1 fi @@ -369,7 +369,7 @@ stop_windows() { } status_windows() { - if [ ! -f "$COMPOSE_FILE" ]; then + if [[ ! -f $COMPOSE_FILE ]]; then echo "Windows VM not configured." echo "To set up: omarchy-windows-vm install" exit 1 @@ -377,10 +377,10 @@ status_windows() { CONTAINER_STATUS=$(docker inspect --format='{{.State.Status}}' omarchy-windows 2>/dev/null) - if [ -z "$CONTAINER_STATUS" ]; then + if [[ -z $CONTAINER_STATUS ]]; then echo "Windows VM container not found." echo "To start: omarchy-windows-vm launch" - elif [ "$CONTAINER_STATUS" = "running" ]; then + elif [[ $CONTAINER_STATUS = "running" ]]; then gum style \ --border normal \ --padding "1 2" \ diff --git a/install/config/git.sh b/install/config/git.sh index 22ad70f6..3e2ef89d 100644 --- a/install/config/git.sh +++ b/install/config/git.sh @@ -1,8 +1,8 @@ # Set identification from install inputs -if [[ -n "${OMARCHY_USER_NAME//[[:space:]]/}" ]]; then +if [[ -n ${OMARCHY_USER_NAME//[[:space:]]/} ]]; then git config --global user.name "$OMARCHY_USER_NAME" fi -if [[ -n "${OMARCHY_USER_EMAIL//[[:space:]]/}" ]]; then +if [[ -n ${OMARCHY_USER_EMAIL//[[:space:]]/} ]]; then git config --global user.email "$OMARCHY_USER_EMAIL" fi diff --git a/install/config/hardware/fix-apple-spi-keyboard.sh b/install/config/hardware/fix-apple-spi-keyboard.sh index e0384788..d2aa6c4b 100644 --- a/install/config/hardware/fix-apple-spi-keyboard.sh +++ b/install/config/hardware/fix-apple-spi-keyboard.sh @@ -1,10 +1,10 @@ # Detect MacBook models that need SPI keyboard modules product_name="$(cat /sys/class/dmi/id/product_name 2>/dev/null)" -if [[ "$product_name" =~ MacBook[89],1|MacBook1[02],1|MacBookPro13,[123]|MacBookPro14,[123] ]]; then +if [[ $product_name =~ MacBook[89],1|MacBook1[02],1|MacBookPro13,[123]|MacBookPro14,[123] ]]; then echo "Detected MacBook with SPI keyboard" omarchy-pkg-add macbook12-spi-driver-dkms - if [[ "$product_name" == "MacBook8,1" ]]; then + if [[ $product_name == "MacBook8,1" ]]; then echo "MODULES=(applespi spi_pxa2xx_platform spi_pxa2xx_pci)" | sudo tee /etc/mkinitcpio.conf.d/macbook_spi_modules.conf >/dev/null else echo "MODULES=(applespi intel_lpss_pci spi_pxa2xx_platform)" | sudo tee /etc/mkinitcpio.conf.d/macbook_spi_modules.conf >/dev/null diff --git a/install/config/hardware/fix-apple-suspend-nvme.sh b/install/config/hardware/fix-apple-suspend-nvme.sh index 35724112..863242a1 100644 --- a/install/config/hardware/fix-apple-suspend-nvme.sh +++ b/install/config/hardware/fix-apple-suspend-nvme.sh @@ -2,12 +2,12 @@ # This prevents NVMe drives from failing to wake from sleep properly MACBOOK_MODEL=$(cat /sys/class/dmi/id/product_name 2>/dev/null || true) -if [[ "$MACBOOK_MODEL" =~ MacBook(8,1|9,1|10,1)|MacBookPro13,[123]|MacBookPro14,[123] ]]; then +if [[ $MACBOOK_MODEL =~ MacBook(8,1|9,1|10,1)|MacBookPro13,[123]|MacBookPro14,[123] ]]; then echo "Detected MacBook model: $MACBOOK_MODEL" NVME_DEVICE="/sys/bus/pci/devices/0000:01:00.0/d3cold_allowed" - if [[ -f "$NVME_DEVICE" ]]; then + if [[ -f $NVME_DEVICE ]]; then echo "Applying NVMe suspend fix..." cat </dev/null diff --git a/install/config/hardware/fix-asus-rog-audio-mixer.sh b/install/config/hardware/fix-asus-rog-audio-mixer.sh index 31401317..7380721f 100644 --- a/install/config/hardware/fix-asus-rog-audio-mixer.sh +++ b/install/config/hardware/fix-asus-rog-audio-mixer.sh @@ -7,7 +7,7 @@ if omarchy-hw-asus-rog; then # Unmute the Master control on the ALC285 card (often muted by default) card=$(aplay -l 2>/dev/null | grep -i "ALC285" | head -1 | sed 's/card \([0-9]*\).*/\1/') - if [[ -n "$card" ]]; then + if [[ -n $card ]]; then amixer -c "$card" set Master 80% unmute 2>/dev/null fi fi diff --git a/install/config/hardware/fix-surface-keyboard.sh b/install/config/hardware/fix-surface-keyboard.sh index d68fe5ae..6c379337 100644 --- a/install/config/hardware/fix-surface-keyboard.sh +++ b/install/config/hardware/fix-surface-keyboard.sh @@ -2,17 +2,17 @@ # Module list derived from Chris McLeod's manual install instructions # https://chrismcleod.dev/blog/installing-arch-linux-with-secure-boot-on-a-microsoft-surface-laptop-studio/ product_name="$(cat /sys/class/dmi/id/product_name 2>/dev/null)" -if [[ "$product_name" =~ Surface ]]; then +if [[ $product_name =~ Surface ]]; then echo "Detected Surface Device" # Modules already exist in the rootfs for the default kernel. - if [[ "$product_name" != "Surface Laptop 3" ]]; then + if [[ $product_name != "Surface Laptop 3" ]]; then echo "Untested Surface Device: $product_name, additional modules may be required for your device." fi echo "Attempting to autodetect required pinctrl module" pinctrl_module=$(lsmod | grep pinctrl_ | cut -f 1 -d" ") - if [[ -z "$pinctrl_module" ]]; then + if [[ -z $pinctrl_module ]]; then echo "Failed to autodetect pinctrl module." else echo "Detected pinctrl module: $pinctrl_module" diff --git a/install/config/hardware/intel.sh b/install/config/hardware/intel.sh index c80375e2..f1c375d7 100644 --- a/install/config/hardware/intel.sh +++ b/install/config/hardware/intel.sh @@ -2,9 +2,9 @@ # Check if we have an Intel GPU at all if INTEL_GPU=$(lspci | grep -iE 'vga|3d|display' | grep -i 'intel'); then # HD Graphics and newer uses intel-media-driver - if [[ "${INTEL_GPU,,}" =~ "hd graphics"|"xe"|"iris" ]]; then + if [[ ${INTEL_GPU,,} =~ "hd graphics"|"xe"|"iris" ]]; then omarchy-pkg-add intel-media-driver - elif [[ "${INTEL_GPU,,}" =~ "gma" ]]; then + elif [[ ${INTEL_GPU,,} =~ "gma" ]]; then # Older generations from 2008 to ~2014-2017 use libva-intel-driver omarchy-pkg-add libva-intel-driver fi diff --git a/install/config/hardware/legacy-gpu-terminal.sh b/install/config/hardware/legacy-gpu-terminal.sh index d1cd9113..504cc101 100644 --- a/install/config/hardware/legacy-gpu-terminal.sh +++ b/install/config/hardware/legacy-gpu-terminal.sh @@ -4,11 +4,11 @@ legacy_drivers=("radeon") for card in /sys/class/drm/card*; do - if [[ -e "$card/device/driver" ]]; then + if [[ -e $card/device/driver ]]; then driver=$(basename "$(readlink -f "$card/device/driver")") for legacy in "${legacy_drivers[@]}"; do - if [[ "$driver" == "$legacy" ]]; then + if [[ $driver == $legacy ]]; then omarchy-install-terminal alacritty exit 0 fi diff --git a/install/config/hardware/nvidia.sh b/install/config/hardware/nvidia.sh index e05866ee..5fb37232 100644 --- a/install/config/hardware/nvidia.sh +++ b/install/config/hardware/nvidia.sh @@ -1,6 +1,6 @@ NVIDIA="$(lspci | grep -i 'nvidia')" -if [ -n "$NVIDIA" ]; then +if [[ -n $NVIDIA ]]; then # Check which kernel is installed and set appropriate headers package KERNEL_HEADERS="$(pacman -Qqs '^linux(-zen|-lts|-hardened)?$' | head -1)-headers" @@ -14,7 +14,7 @@ if [ -n "$NVIDIA" ]; then GPU_ARCH="maxwell_pascal_volta" fi # Bail if no supported GPU - if [ -z "${PACKAGES+x}" ]; then + if [[ -z ${PACKAGES+x} ]]; then echo "No compatible driver for your NVIDIA GPU. See: https://wiki.archlinux.org/title/NVIDIA" exit 0 fi @@ -32,7 +32,7 @@ MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm) EOF # Add NVIDIA environment variables based on GPU architecture - if [ "$GPU_ARCH" = "turing_plus" ]; then + if [[ $GPU_ARCH = "turing_plus" ]]; then # Turing+ (RTX 20xx, GTX 16xx, and newer) with GSP firmware support cat >>"$HOME/.config/hypr/envs.conf" <<'EOF' @@ -41,7 +41,7 @@ env = NVD_BACKEND,direct env = LIBVA_DRIVER_NAME,nvidia env = __GLX_VENDOR_LIBRARY_NAME,nvidia EOF - elif [ "$GPU_ARCH" = "maxwell_pascal_volta" ]; then + elif [[ $GPU_ARCH = "maxwell_pascal_volta" ]]; then # Maxwell/Pascal/Volta (GTX 9xx/10xx, GT 10xx, Quadro P/M/GV, MX series, Titan X/Xp/V) lack GSP firmware cat >>"$HOME/.config/hypr/envs.conf" <<'EOF' diff --git a/install/config/hardware/set-wireless-regdom.sh b/install/config/hardware/set-wireless-regdom.sh index 8f28407f..8524f2d3 100644 --- a/install/config/hardware/set-wireless-regdom.sh +++ b/install/config/hardware/set-wireless-regdom.sh @@ -1,13 +1,13 @@ # First check that wireless-regdb is there -if [ -f "/etc/conf.d/wireless-regdom" ]; then +if [[ -f "/etc/conf.d/wireless-regdom" ]]; then unset WIRELESS_REGDOM . /etc/conf.d/wireless-regdom fi # If the region is already set, we're done -if [ ! -n "${WIRELESS_REGDOM}" ]; then +if [[ ! -n ${WIRELESS_REGDOM} ]]; then # Get the current timezone - if [ -e "/etc/localtime" ]; then + if [[ -e "/etc/localtime" ]]; then TIMEZONE=$(readlink -f /etc/localtime) TIMEZONE=${TIMEZONE#/usr/share/zoneinfo/} @@ -15,12 +15,12 @@ if [ ! -n "${WIRELESS_REGDOM}" ]; then COUNTRY="${TIMEZONE%%/*}" # If we don't have a two letter country, get it from the timezone table - if [[ ! "$COUNTRY" =~ ^[A-Z]{2}$ ]] && [ -f "/usr/share/zoneinfo/zone.tab" ]; then + if [[ ! $COUNTRY =~ ^[A-Z]{2}$ ]] && [[ -f /usr/share/zoneinfo/zone.tab ]]; then COUNTRY=$(awk -v tz="$TIMEZONE" '$3 == tz {print $1; exit}' /usr/share/zoneinfo/zone.tab) fi # Check if we have a two letter country code - if [[ "$COUNTRY" =~ ^[A-Z]{2}$ ]]; then + if [[ $COUNTRY =~ ^[A-Z]{2}$ ]]; then # Append it to the wireless-regdom conf file that is used at boot echo "WIRELESS_REGDOM=\"$COUNTRY\"" | sudo tee -a /etc/conf.d/wireless-regdom >/dev/null diff --git a/install/config/hardware/vulkan.sh b/install/config/hardware/vulkan.sh index 40d0e2fb..a2447d46 100644 --- a/install/config/hardware/vulkan.sh +++ b/install/config/hardware/vulkan.sh @@ -15,6 +15,6 @@ for vendor in "${!VULKAN_DRIVERS[@]}"; do fi done -if [ ${#PACKAGES[@]} -gt 0 ]; then +if (( ${#PACKAGES[@]} > 0 )); then omarchy-pkg-add "${PACKAGES[@]}" fi diff --git a/install/config/mise-work.sh b/install/config/mise-work.sh index 532ad350..e919dee9 100644 --- a/install/config/mise-work.sh +++ b/install/config/mise-work.sh @@ -10,7 +10,7 @@ EOF mise trust ~/Work/.mise.toml -if [[ -n "${OMARCHY_CHROOT_INSTALL:-}" ]]; then +if [[ -n ${OMARCHY_CHROOT_INSTALL:-} ]]; then NODE_TARBALL=$(find /opt/packages -name "node-v*-linux-x64.tar.gz" -type f 2>/dev/null | head -n1) NODE_VERSION=$(basename "$NODE_TARBALL" | sed 's/node-v\(.*\)-linux-x64.tar.gz/\1/') diff --git a/install/config/powerprofilesctl-rules.sh b/install/config/powerprofilesctl-rules.sh index da18f24d..3ff3a5b9 100644 --- a/install/config/powerprofilesctl-rules.sh +++ b/install/config/powerprofilesctl-rules.sh @@ -1,7 +1,7 @@ if omarchy-battery-present; then mapfile -t profiles < <(omarchy-powerprofiles-list) - if [[ ${#profiles[@]} -gt 1 ]]; then + if (( ${#profiles[@]} > 1 )); then # Default AC profile: # 3 profiles → performance diff --git a/install/helpers/chroot.sh b/install/helpers/chroot.sh index ab61972e..b9541972 100644 --- a/install/helpers/chroot.sh +++ b/install/helpers/chroot.sh @@ -1,6 +1,6 @@ # Starting the installer with OMARCHY_CHROOT_INSTALL=1 will put it into chroot mode chrootable_systemctl_enable() { - if [ -n "${OMARCHY_CHROOT_INSTALL:-}" ]; then + if [[ -n ${OMARCHY_CHROOT_INSTALL:-} ]]; then sudo systemctl enable $1 else sudo systemctl enable --now $1 diff --git a/install/helpers/errors.sh b/install/helpers/errors.sh index 2b63409b..8b54219d 100644 --- a/install/helpers/errors.sh +++ b/install/helpers/errors.sh @@ -25,7 +25,7 @@ show_cursor() { # Display truncated log lines from the install log show_log_tail() { if [[ -f $OMARCHY_INSTALL_LOG_FILE ]]; then - local log_lines=$(($TERM_HEIGHT - $LOGO_HEIGHT - 35)) + local log_lines=$((TERM_HEIGHT - LOGO_HEIGHT - 35)) local max_line_width=$((LOGO_WIDTH - 4)) tail -n $log_lines "$OMARCHY_INSTALL_LOG_FILE" | while IFS= read -r line; do @@ -67,7 +67,7 @@ save_original_outputs() { # Restore stdout and stderr to original (saved in FD 3 and 4) # This ensures output goes to screen, not log file restore_outputs() { - if [ -e /proc/self/fd/3 ] && [ -e /proc/self/fd/4 ]; then + if [[ -e /proc/self/fd/3 ]] && [[ -e /proc/self/fd/4 ]]; then exec 1>&3 2>&4 fi } @@ -75,7 +75,7 @@ restore_outputs() { # Error handler catch_errors() { # Prevent recursive error handling - if [[ $ERROR_HANDLING == true ]]; then + if [[ $ERROR_HANDLING == "true" ]]; then return else ERROR_HANDLING=true @@ -147,7 +147,7 @@ exit_handler() { local exit_code=$? # Only run if we're exiting with an error and haven't already handled it - if [[ $exit_code -ne 0 && $ERROR_HANDLING != true ]]; then + if (( exit_code != 0 )) && [[ $ERROR_HANDLING != "true" ]]; then catch_errors else stop_log_output diff --git a/install/helpers/logging.sh b/install/helpers/logging.sh index 4ebe2a9e..88693657 100644 --- a/install/helpers/logging.sh +++ b/install/helpers/logging.sh @@ -24,12 +24,12 @@ start_log_output() { line="${current_lines[i]:-}" # Truncate if needed - if [ ${#line} -gt $max_line_width ]; then + if (( ${#line} > max_line_width )); then line="${line:0:$max_line_width}..." fi # Add clear line escape and formatted output for each line - if [ -n "$line" ]; then + if [[ -n $line ]]; then output+="${ANSI_CLEAR_LINE}${ANSI_GRAY}${PADDING_LEFT_SPACES} → ${line}${ANSI_RESET}\n" else output+="${ANSI_CLEAR_LINE}${PADDING_LEFT_SPACES}\n" @@ -45,7 +45,7 @@ start_log_output() { } stop_log_output() { - if [ -n "${monitor_pid:-}" ]; then + if [[ -n ${monitor_pid:-} ]]; then kill $monitor_pid 2>/dev/null || true wait $monitor_pid 2>/dev/null || true unset monitor_pid @@ -72,11 +72,11 @@ stop_install_log() { echo "" >>"$OMARCHY_INSTALL_LOG_FILE" echo "=== Installation Time Summary ===" >>"$OMARCHY_INSTALL_LOG_FILE" - if [ -f "/var/log/archinstall/install.log" ]; then + if [[ -f "/var/log/archinstall/install.log" ]]; then ARCHINSTALL_START=$(grep -m1 '^\[' /var/log/archinstall/install.log 2>/dev/null | sed 's/^\[\([^]]*\)\].*/\1/' || true) ARCHINSTALL_END=$(grep 'Installation completed without any errors' /var/log/archinstall/install.log 2>/dev/null | sed 's/^\[\([^]]*\)\].*/\1/' || true) - if [ -n "$ARCHINSTALL_START" ] && [ -n "$ARCHINSTALL_END" ]; then + if [[ -n $ARCHINSTALL_START ]] && [[ -n $ARCHINSTALL_END ]]; then ARCH_START_EPOCH=$(date -d "$ARCHINSTALL_START" +%s) ARCH_END_EPOCH=$(date -d "$ARCHINSTALL_END" +%s) ARCH_DURATION=$((ARCH_END_EPOCH - ARCH_START_EPOCH)) @@ -88,7 +88,7 @@ stop_install_log() { fi fi - if [ -n "$OMARCHY_START_TIME" ]; then + if [[ -n $OMARCHY_START_TIME ]]; then OMARCHY_START_EPOCH=$(date -d "$OMARCHY_START_TIME" +%s) OMARCHY_END_EPOCH=$(date -d "$OMARCHY_END_TIME" +%s) OMARCHY_DURATION=$((OMARCHY_END_EPOCH - OMARCHY_START_EPOCH)) @@ -98,7 +98,7 @@ stop_install_log() { echo "Omarchy: ${OMARCHY_MINS}m ${OMARCHY_SECS}s" >>"$OMARCHY_INSTALL_LOG_FILE" - if [ -n "$ARCH_DURATION" ]; then + if [[ -n $ARCH_DURATION ]]; then TOTAL_DURATION=$((ARCH_DURATION + OMARCHY_DURATION)) TOTAL_MINS=$((TOTAL_DURATION / 60)) TOTAL_SECS=$((TOTAL_DURATION % 60)) @@ -123,7 +123,7 @@ run_logged() { local exit_code=$? - if [ $exit_code -eq 0 ]; then + if (( exit_code == 0 )); then echo "[$(date '+%Y-%m-%d %H:%M:%S')] Completed: $script" >>"$OMARCHY_INSTALL_LOG_FILE" unset CURRENT_SCRIPT else diff --git a/install/helpers/presentation.sh b/install/helpers/presentation.sh index 5a07abad..3f4c0656 100644 --- a/install/helpers/presentation.sh +++ b/install/helpers/presentation.sh @@ -4,10 +4,10 @@ if ! command -v gum &>/dev/null; then fi # Get terminal size from /dev/tty (works in all scenarios: direct, sourced, or piped) -if [ -e /dev/tty ]; then +if [[ -e /dev/tty ]]; then TERM_SIZE=$(stty size 2>/dev/null max) max = length } END { print max+0 }' "$LOGO_PATH" 2>/dev/null || echo 0) export LOGO_HEIGHT=$(wc -l <"$LOGO_PATH" 2>/dev/null || echo 0) -export PADDING_LEFT=$((($TERM_WIDTH - $LOGO_WIDTH) / 2)) +export PADDING_LEFT=$(((TERM_WIDTH - LOGO_WIDTH) / 2)) export PADDING_LEFT_SPACES=$(printf "%*s" $PADDING_LEFT "") # Tokyo Night theme for gum confirm diff --git a/install/login/limine-snapper.sh b/install/login/limine-snapper.sh index a2f9810f..44c8cddc 100644 --- a/install/login/limine-snapper.sh +++ b/install/login/limine-snapper.sh @@ -38,7 +38,7 @@ EOF fi # Remove the original config file if it's not /boot/limine.conf - if [[ "$limine_config" != "/boot/limine.conf" ]] && [[ -f "$limine_config" ]]; then + if [[ $limine_config != "/boot/limine.conf" ]] && [[ -f $limine_config ]]; then sudo rm "$limine_config" fi @@ -73,11 +73,11 @@ fi echo "Re-enabling mkinitcpio hooks..." # Restore the specific mkinitcpio pacman hooks -if [ -f /usr/share/libalpm/hooks/90-mkinitcpio-install.hook.disabled ]; then +if [[ -f /usr/share/libalpm/hooks/90-mkinitcpio-install.hook.disabled ]]; then sudo mv /usr/share/libalpm/hooks/90-mkinitcpio-install.hook.disabled /usr/share/libalpm/hooks/90-mkinitcpio-install.hook fi -if [ -f /usr/share/libalpm/hooks/60-mkinitcpio-remove.hook.disabled ]; then +if [[ -f /usr/share/libalpm/hooks/60-mkinitcpio-remove.hook.disabled ]]; then sudo mv /usr/share/libalpm/hooks/60-mkinitcpio-remove.hook.disabled /usr/share/libalpm/hooks/60-mkinitcpio-remove.hook fi @@ -99,7 +99,7 @@ fi # # uki_file=$(find /boot/EFI/Linux/ -name "omarchy*.efi" -printf "%f\n" 2>/dev/null | head -1) # -# if [[ -n "$uki_file" ]]; then +# if [[ -n $uki_file ]]; then # sudo efibootmgr --create \ # --disk "$(findmnt -n -o SOURCE /boot | sed 's/p\?[0-9]*$//')" \ # --part "$(findmnt -n -o SOURCE /boot | grep -o 'p\?[0-9]*$' | sed 's/^p//')" \ diff --git a/install/login/plymouth.sh b/install/login/plymouth.sh index fad64fe2..291c47ab 100644 --- a/install/login/plymouth.sh +++ b/install/login/plymouth.sh @@ -1,4 +1,4 @@ -if [ "$(plymouth-set-default-theme)" != "omarchy" ]; then +if [[ $(plymouth-set-default-theme) != "omarchy" ]]; then sudo cp -r "$HOME/.local/share/omarchy/default/plymouth" /usr/share/plymouth/themes/omarchy/ sudo plymouth-set-default-theme omarchy fi diff --git a/install/login/sddm.sh b/install/login/sddm.sh index 0098387e..1cbd5d7c 100644 --- a/install/login/sddm.sh +++ b/install/login/sddm.sh @@ -1,6 +1,6 @@ sudo mkdir -p /etc/sddm.conf.d -if [ ! -f /etc/sddm.conf.d/autologin.conf ]; then +if [[ ! -f /etc/sddm.conf.d/autologin.conf ]]; then cat </dev/null; then echo TOTAL_TIME=$(tail -n 20 "$OMARCHY_INSTALL_LOG_FILE" | grep "^Total:" | sed 's/^Total:[[:space:]]*//') - if [ -n "$TOTAL_TIME" ]; then + if [[ -n $TOTAL_TIME ]]; then echo_in_style "Installed in $TOTAL_TIME" fi else @@ -29,7 +29,7 @@ if gum confirm --padding "0 0 0 $((PADDING_LEFT + 32))" --show-help=false --defa # Clear screen to hide any shutdown messages clear - if [[ -n "${OMARCHY_CHROOT_INSTALL:-}" ]]; then + if [[ -n ${OMARCHY_CHROOT_INSTALL:-} ]]; then touch /var/tmp/omarchy-install-completed exit 0 else diff --git a/install/preflight/disable-mkinitcpio.sh b/install/preflight/disable-mkinitcpio.sh index a1979c86..731816e8 100644 --- a/install/preflight/disable-mkinitcpio.sh +++ b/install/preflight/disable-mkinitcpio.sh @@ -4,11 +4,11 @@ echo "Temporarily disabling mkinitcpio hooks during installation..." # Move the specific mkinitcpio pacman hooks out of the way if they exist -if [ -f /usr/share/libalpm/hooks/90-mkinitcpio-install.hook ]; then +if [[ -f /usr/share/libalpm/hooks/90-mkinitcpio-install.hook ]]; then sudo mv /usr/share/libalpm/hooks/90-mkinitcpio-install.hook /usr/share/libalpm/hooks/90-mkinitcpio-install.hook.disabled fi -if [ -f /usr/share/libalpm/hooks/60-mkinitcpio-remove.hook ]; then +if [[ -f /usr/share/libalpm/hooks/60-mkinitcpio-remove.hook ]]; then sudo mv /usr/share/libalpm/hooks/60-mkinitcpio-remove.hook /usr/share/libalpm/hooks/60-mkinitcpio-remove.hook.disabled fi diff --git a/install/preflight/guard.sh b/install/preflight/guard.sh index da312023..782614fd 100644 --- a/install/preflight/guard.sh +++ b/install/preflight/guard.sh @@ -11,18 +11,18 @@ fi # Must not be an Arch derivative distro for marker in /etc/cachyos-release /etc/eos-release /etc/garuda-release /etc/manjaro-release; do - if [[ -f "$marker" ]]; then + if [[ -f $marker ]]; then abort "Vanilla Arch" fi done # Must not be running as root -if [ "$EUID" -eq 0 ]; then +if (( EUID == 0 )); then abort "Running as root (not user)" fi # Must be x86 only to fully work -if [ "$(uname -m)" != "x86_64" ]; then +if [[ $(uname -m) != "x86_64" ]]; then abort "x86_64 CPU" fi @@ -40,7 +40,7 @@ fi command -v limine &>/dev/null || abort "Limine bootloader" # Must have btrfs root filesystem -[ "$(findmnt -n -o FSTYPE /)" = "btrfs" ] || abort "Btrfs root filesystem" +[[ $(findmnt -n -o FSTYPE /) = "btrfs" ]] || abort "Btrfs root filesystem" # Cleared all guards echo "Guards: OK" diff --git a/migrations/1752292967.sh b/migrations/1752292967.sh index d587fc4c..c1b8fa2b 100644 --- a/migrations/1752292967.sh +++ b/migrations/1752292967.sh @@ -4,13 +4,13 @@ if omarchy-cmd-missing uwsm; then sudo rm -f /etc/systemd/system/getty@tty1.service.d/override.conf sudo rmdir /etc/systemd/system/getty@tty1.service.d/ 2>/dev/null || true - if [ -f "$HOME/.bash_profile" ]; then + if [[ -f $HOME/.bash_profile ]]; then # Remove the specific line sed -i '/^\[\[ -z \$DISPLAY && \$(tty) == \/dev\/tty1 \]\] && exec Hyprland$/d' "$HOME/.bash_profile" echo "Cleaned up .bash_profile" fi - if [ -f "$HOME/.config/environment.d/fcitx.conf" ]; then + if [[ -f $HOME/.config/environment.d/fcitx.conf ]]; then echo "Removing GTK_IM_MODULE from fcitx config for Wayland..." sed -i 's/^GTK_IM_MODULE=fcitx$//' "$HOME/.config/environment.d/fcitx.conf" fi diff --git a/migrations/1752535084.sh b/migrations/1752535084.sh index 5a3b3b31..092c429d 100644 --- a/migrations/1752535084.sh +++ b/migrations/1752535084.sh @@ -1,6 +1,6 @@ echo "Set a default fontconfig" -if [[ ! -f "$HOME/.config/fontconfig/fonts.conf" ]]; then +if [[ ! -f $HOME/.config/fontconfig/fonts.conf ]]; then mkdir -p ~/.config/fontconfig cp ~/.local/share/omarchy/config/fontconfig/fonts.conf ~/.config/fontconfig/ fc-cache -fv diff --git a/migrations/1754860578.sh b/migrations/1754860578.sh index c384c7af..a25fdcc6 100644 --- a/migrations/1754860578.sh +++ b/migrations/1754860578.sh @@ -1,7 +1,7 @@ echo "Update polkit policy to yield to fingerprint and fido2" # If fprint exists in polkit, it was wrong and needs reset -if [ -f /etc/pam.d/polkit-1 ] && grep -Fq 'pam_fprintd.so' /etc/pam.d/polkit-1; then +if [[ -f /etc/pam.d/polkit-1 ]] && grep -Fq 'pam_fprintd.so' /etc/pam.d/polkit-1; then sudo tee /etc/pam.d/polkit-1 >/dev/null <<'EOF' auth sufficient pam_fprintd.so auth required pam_unix.so @@ -13,9 +13,9 @@ EOF fi # If fido2 is in sudo, it won't be in polkit either way -if grep -q pam_u2f.so /etc/pam.d/sudo && [ -f /etc/pam.d/polkit-1 ] && ! grep -q 'pam_u2f.so' /etc/pam.d/polkit-1; then +if grep -q pam_u2f.so /etc/pam.d/sudo && [[ -f /etc/pam.d/polkit-1 ]] && ! grep -q 'pam_u2f.so' /etc/pam.d/polkit-1; then sudo sed -i '1i auth sufficient pam_u2f.so cue authfile=/etc/fido2/fido2' /etc/pam.d/polkit-1 -elif grep -q pam_u2f.so /etc/pam.d/sudo && [ ! -f /etc/pam.d/polkit-1 ]; then +elif grep -q pam_u2f.so /etc/pam.d/sudo && [[ ! -f /etc/pam.d/polkit-1 ]]; then sudo tee /etc/pam.d/polkit-1 >/dev/null <<'EOF' auth sufficient pam_u2f.so cue authfile=/etc/fido2/fido2 auth required pam_unix.so diff --git a/migrations/1755109182.sh b/migrations/1755109182.sh index 1908b94a..678348d6 100644 --- a/migrations/1755109182.sh +++ b/migrations/1755109182.sh @@ -4,7 +4,7 @@ echo "Reset DNS configuration to DHCP (remove forced Cloudflare DNS)" # This preserves local development environments (.local domains, etc.) # Users can still opt-in to Cloudflare DNS using: omarchy-setup-dns cloudflare -if [ -f /etc/systemd/resolved.conf ]; then +if [[ -f /etc/systemd/resolved.conf ]]; then # Backup current config with timestamp backup_timestamp=$(date +"%Y%m%d%H%M%S") sudo cp /etc/systemd/resolved.conf "/etc/systemd/resolved.conf.bak.${backup_timestamp}" @@ -18,7 +18,7 @@ if [ -f /etc/systemd/resolved.conf ]; then echo "FallbackDNS=" | sudo tee -a /etc/systemd/resolved.conf >/dev/null # Remove any forced DNS config from systemd-networkd - if [ -f /etc/systemd/network/99-omarchy-dns.network ]; then + if [[ -f /etc/systemd/network/99-omarchy-dns.network ]]; then sudo rm -f /etc/systemd/network/99-omarchy-dns.network sudo systemctl restart systemd-networkd fi diff --git a/migrations/1755507891.sh b/migrations/1755507891.sh index 28114400..62ae8ae9 100644 --- a/migrations/1755507891.sh +++ b/migrations/1755507891.sh @@ -5,7 +5,7 @@ for desktop_file in ~/.local/share/applications/*.desktop; do if grep -q 'Exec=chromium --new-window --ozone-platform=wayland --app=' "$desktop_file"; then url=$(grep '^Exec=' "$desktop_file" | sed -n 's/.*--app="\?\([^"]*\)"\?.*/\1/p') - if [[ -n "$url" ]]; then + if [[ -n $url ]]; then sed -i "s|^Exec=.*|Exec=omarchy-launch-webapp \"$url\"|" "$desktop_file" fi fi @@ -13,7 +13,7 @@ done echo "Updating Hyprland bindings" HYPR_BINDINGS_FILE="$HOME/.config/hypr/bindings.conf" -if [ -f "$HYPR_BINDINGS_FILE" ]; then +if [[ -f $HYPR_BINDINGS_FILE ]]; then sed -i 's/\$browser =.*chromium.*$/\$browser = omarchy-launch-browser/' "$HYPR_BINDINGS_FILE" sed -i 's/\$webapp="/omarchy-launch-webapp "/g' "$HYPR_BINDINGS_FILE" sed -i '/^\$webapp = \$browser --app/d' "$HYPR_BINDINGS_FILE" diff --git a/migrations/1756491748.sh b/migrations/1756491748.sh index 801f82a9..882a9c32 100644 --- a/migrations/1756491748.sh +++ b/migrations/1756491748.sh @@ -1,6 +1,6 @@ echo "Removing UseDNS=no from network files to fix DNS issue" for file in /etc/systemd/network/*.network; do - [[ -f "$file" ]] || continue + [[ -f $file ]] || continue sudo sed -i '/^UseDNS=no/d' "$file" done \ No newline at end of file diff --git a/migrations/1757361127.sh b/migrations/1757361127.sh index 5c23e005..de0d6ed8 100644 --- a/migrations/1757361127.sh +++ b/migrations/1757361127.sh @@ -1,6 +1,6 @@ echo "Fix DHCP DNS to allow VPN DNS override" -if [ -f /etc/systemd/resolved.conf ]; then +if [[ -f /etc/systemd/resolved.conf ]]; then if grep -q "^DNS=$" /etc/systemd/resolved.conf && grep -q "^FallbackDNS=$" /etc/systemd/resolved.conf; then sudo sed -i '/^DNS=$/d; /^FallbackDNS=$/d' /etc/systemd/resolved.conf sudo systemctl restart systemd-resolved diff --git a/migrations/1758107879.sh b/migrations/1758107879.sh index aaae09df..40cb89d7 100644 --- a/migrations/1758107879.sh +++ b/migrations/1758107879.sh @@ -28,7 +28,7 @@ for pkg in "${PACKAGES[@]}"; do done WALKER_MAJOR=$(walker -v 2>&1 | grep -oP '^\d+' || echo "0") -if [[ "$WALKER_MAJOR" -lt 2 ]]; then +if (( WALKER_MAJOR < 2 )); then NEEDS_MIGRATION=true fi diff --git a/migrations/1758142943.sh b/migrations/1758142943.sh index ef800abc..e9ed7944 100644 --- a/migrations/1758142943.sh +++ b/migrations/1758142943.sh @@ -9,7 +9,7 @@ VS_CODE_SETTINGS="$HOME/.config/Code/User/settings.json" if omarchy-cmd-present code; then mkdir -p "$(dirname "$VS_CODE_SETTINGS")" - if [[ ! -f "$VS_CODE_SETTINGS" ]]; then + if [[ ! -f $VS_CODE_SETTINGS ]]; then # If settings.json doesn't exist, create it with just the update.mode setting printf '{\n "update.mode": "none"\n}\n' > "$VS_CODE_SETTINGS" elif ! grep -q '"update.mode"' "$VS_CODE_SETTINGS"; then diff --git a/migrations/1758436991.sh b/migrations/1758436991.sh index b9a2e7b5..d8ae9ebb 100644 --- a/migrations/1758436991.sh +++ b/migrations/1758436991.sh @@ -5,13 +5,12 @@ ICON_DIR="$APP_DIR/icons" # Don't use omarchy-tui-remove to preserve icons -if [[ -f "$APP_DIR/Docker.desktop" ]]; then +if [[ -f $APP_DIR/Docker.desktop ]]; then rm "$APP_DIR/Docker.desktop" omarchy-tui-install "Docker" "lazydocker" tile "$ICON_DIR/Docker.png" fi -if [[ -f "$APP_DIR/Disk Usage.desktop" ]]; then +if [[ -f $APP_DIR/"Disk Usage.desktop" ]]; then rm "$APP_DIR/Disk Usage.desktop" omarchy-tui-install "Disk Usage" "bash -c 'dust -r; read -n 1 -s'" float "$ICON_DIR/Disk Usage.png" fi - diff --git a/migrations/1758487662_move_to_custom_uki.sh b/migrations/1758487662_move_to_custom_uki.sh index 731bba2a..a29376d8 100644 --- a/migrations/1758487662_move_to_custom_uki.sh +++ b/migrations/1758487662_move_to_custom_uki.sh @@ -15,7 +15,7 @@ if command -v limine &>/dev/null && [[ -f /etc/default/limine ]]; then uki_file=$(find /boot/EFI/Linux/ -name "omarchy*.efi" -printf "%f\n" 2>/dev/null | head -1) - if [[ -n "$uki_file" ]]; then + if [[ -n $uki_file ]]; then while IFS= read -r bootnum; do sudo efibootmgr -b "$bootnum" -B >/dev/null 2>&1 done < <(efibootmgr | grep -E "^Boot[0-9]{4}\*? Omarchy" | sed 's/^Boot\([0-9]\{4\}\).*/\1/') diff --git a/migrations/1760304963.sh b/migrations/1760304963.sh index e1c519c6..588d4f46 100644 --- a/migrations/1760304963.sh +++ b/migrations/1760304963.sh @@ -1,6 +1,6 @@ echo "Add a default keyring for gnome-keyring that unlocks on login" -if [ -f "$HOME/.local/share/keyrings/Default_keyring.keyring" ] || [ -f "$HOME/.local/share/keyrings/default" ]; then +if [[ -f $HOME/.local/share/keyrings/Default_keyring.keyring ]] || [[ -f $HOME/.local/share/keyrings/default ]]; then if gum confirm "Do you want to replace existing keyring with one that's auto-unlocked on login?"; then bash "$OMARCHY_PATH/install/login/default-keyring.sh" fi diff --git a/migrations/1760724934.sh b/migrations/1760724934.sh index cc218ffb..9781a25b 100644 --- a/migrations/1760724934.sh +++ b/migrations/1760724934.sh @@ -17,7 +17,7 @@ omarchy-pkg-add grim slurp wayfreeze-git echo "Add nfs support by default to Nautilus" omarchy-pkg-add gvfs-nfs -if [ ! -d "$HOME/.config/nvim" ]; then +if [[ ! -d $HOME/.config/nvim ]]; then echo "Add missing nvim config" omarchy-nvim-setup fi diff --git a/migrations/1761180745.sh b/migrations/1761180745.sh index 5a6b1e0f..c0e31eb5 100644 --- a/migrations/1761180745.sh +++ b/migrations/1761180745.sh @@ -2,6 +2,6 @@ echo "Ensure interactive shell check is at the top of .bashrc" BASHRC="$HOME/.bashrc" -if [ -f "$BASHRC" ] && ! grep -q '\[\[ $- != \*i\* \]\] && return' "$BASHRC"; then +if [[ -f $BASHRC ]] && ! grep -q '\[\[ $- != \*i\* \]\] && return' "$BASHRC"; then sed -i '1i# If not running interactively, don'\''t do anything (leave this at the top of this file)\n[[ $- != *i* ]] && return\n' "$BASHRC" fi diff --git a/migrations/1761269603.sh b/migrations/1761269603.sh index 8d29f613..700a3efa 100644 --- a/migrations/1761269603.sh +++ b/migrations/1761269603.sh @@ -2,6 +2,6 @@ echo "Add right-click terminal action to waybar omarchy menu icon" WAYBAR_CONFIG="$HOME/.config/waybar/config.jsonc" -if [[ -f "$WAYBAR_CONFIG" ]] && ! grep -A5 '"custom/omarchy"' "$WAYBAR_CONFIG" | grep -q '"on-click-right"'; then +if [[ -f $WAYBAR_CONFIG ]] && ! grep -A5 '"custom/omarchy"' "$WAYBAR_CONFIG" | grep -q '"on-click-right"'; then sed -i '/"on-click": "omarchy-menu",/a\ "on-click-right": "omarchy-launch-terminal",' "$WAYBAR_CONFIG" fi diff --git a/migrations/1761569743.sh b/migrations/1761569743.sh index f45e7bfd..976df478 100644 --- a/migrations/1761569743.sh +++ b/migrations/1761569743.sh @@ -1,6 +1,6 @@ echo "Add default Ctrl+P binding for imv; backup existing config if present" -if [ -f ~/.config/imv/config ]; then +if [[ -f ~/.config/imv/config ]]; then cp ~/.config/imv/config ~/.config/imv/config.bak.$(date +%s) else mkdir -p ~/.config/imv diff --git a/migrations/1762121828.sh b/migrations/1762121828.sh index e56d16ca..b7b86c91 100644 --- a/migrations/1762121828.sh +++ b/migrations/1762121828.sh @@ -3,21 +3,21 @@ echo "Setting up xdg-terminal-exec for gtk-launch terminal support" # https://github.com/basecamp/omarchy/issues/1852 # Remove old symlink if it exists -- if someone ran the previous migration early -if [ -L /usr/local/bin/xdg-terminal-exec ]; then +if [[ -L /usr/local/bin/xdg-terminal-exec ]]; then sudo rm /usr/local/bin/xdg-terminal-exec fi omarchy-pkg-add xdg-terminal-exec # Set up xdg-terminals.list based on current $TERMINAL -if [ -n "$TERMINAL" ]; then +if [[ -n $TERMINAL ]]; then case "$TERMINAL" in alacritty) desktop_id="Alacritty.desktop" ;; ghostty) desktop_id="com.mitchellh.ghostty.desktop" ;; kitty) desktop_id="kitty.desktop" ;; esac - if [ -n "$desktop_id" ]; then + if [[ -n $desktop_id ]]; then mkdir -p ~/.config cat > ~/.config/xdg-terminals.list << EOF # Terminal emulator preference order for xdg-terminal-exec @@ -42,7 +42,7 @@ sed -i 's/export TERMINAL=.*/export TERMINAL=xdg-terminal-exec/' ~/.config/uwsm/ # Update waybar config to use xdg-terminal-exec waybar_config=~/.config/waybar/config.jsonc -if [ -f "$waybar_config" ]; then +if [[ -f $waybar_config ]]; then sed -i 's|"on-click-right": "omarchy-launch-terminal"|"on-click-right": "xdg-terminal-exec"|' "$waybar_config" sed -i 's|"on-click": "\$TERMINAL -e btop"|"on-click": "xdg-terminal-exec btop"|' "$waybar_config" sed -i 's|"on-click": "\$TERMINAL --class=Wiremix -e wiremix"|"on-click": "xdg-terminal-exec --app-id=com.omarchy.Wiremix -e wiremix"|' "$waybar_config" @@ -51,7 +51,7 @@ fi # Update hyprland window rules to use DNS-format class names system_conf=~/.config/hypr/apps/system.conf -if [ -f "$system_conf" ]; then +if [[ -f $system_conf ]]; then if grep -q 'class:(.*|Impala|' "$system_conf" || grep -q 'class:(.*|Wiremix|' "$system_conf" || grep -q '|Omarchy|' "$system_conf"; then sed -i 's/\bImpala\b/com.omarchy.Impala/g; s/\bWiremix\b/com.omarchy.Wiremix/g; s/|Omarchy|/|com.omarchy.Omarchy|/g' "$system_conf" fi diff --git a/migrations/1762446739.sh b/migrations/1762446739.sh index 37ad3b1b..c58de3f5 100644 --- a/migrations/1762446739.sh +++ b/migrations/1762446739.sh @@ -1,7 +1,7 @@ echo "Remove alternative limine.conf files" if omarchy-cmd-present limine; then - if [ ! -f /boot/limine.conf ]; then + if [[ ! -f /boot/limine.conf ]]; then echo "Error: /boot/limine.conf does not exist. Do not reboot without resolving this issue!" exit 1 fi diff --git a/migrations/1762684663.sh b/migrations/1762684663.sh index 3ef9a1cd..0d35aecb 100644 --- a/migrations/1762684663.sh +++ b/migrations/1762684663.sh @@ -2,7 +2,7 @@ echo "Update hyprlock font to match current system font" font_name=$(omarchy-font-current) -if [[ -n "$font_name" ]]; then +if [[ -n $font_name ]]; then cp ~/.config/hypr/hyprlock.conf ~/.config/hypr/hyprlock.conf.bak.$(date +%s) echo "Found font '$font_name', updating hyprlock" diff --git a/migrations/1765729055.sh b/migrations/1765729055.sh index 620b33fb..23c11e77 100644 --- a/migrations/1765729055.sh +++ b/migrations/1765729055.sh @@ -1,7 +1,7 @@ echo "Add emergency entry for Walker" CONFIG_FILE="$HOME/.config/walker/config.toml" -if [[ -f "$CONFIG_FILE" ]] && ! grep -q 'command = "omarchy-restart-walker"' "$CONFIG_FILE"; then +if [[ -f $CONFIG_FILE ]] && ! grep -q 'command = "omarchy-restart-walker"' "$CONFIG_FILE"; then cat >> "$CONFIG_FILE" << 'EOF' [[emergencies]] diff --git a/migrations/1767306902.sh b/migrations/1767306902.sh index b8166e49..18d1b395 100644 --- a/migrations/1767306902.sh +++ b/migrations/1767306902.sh @@ -4,7 +4,7 @@ echo "Migrate to new theme setup" OMARCHY_DIR="$HOME/.local/share/omarchy" USER_BACKGROUNDS_DIR="$HOME/.config/omarchy/backgrounds" -if [[ -d "$OMARCHY_DIR/themes" ]]; then +if [[ -d $OMARCHY_DIR/themes ]]; then cd "$OMARCHY_DIR" # Get list of git-tracked background files (relative to omarchy dir) @@ -15,21 +15,21 @@ if [[ -d "$OMARCHY_DIR/themes" ]]; then theme_name=$(basename "$theme_dir") backgrounds_dir="themes/$theme_name/backgrounds" - [[ -d "$backgrounds_dir" ]] || continue + [[ -d $backgrounds_dir ]] || continue for bg_file in "$backgrounds_dir"/*; do - [[ -f "$bg_file" ]] || continue + [[ -f $bg_file ]] || continue # Check if this file is tracked by git is_tracked=false for tracked in "${TRACKED_BACKGROUNDS[@]}"; do - if [[ "$tracked" == "$bg_file" ]]; then + if [[ $tracked == $bg_file ]]; then is_tracked=true break fi done - if [[ "$is_tracked" == "false" ]]; then + if [[ $is_tracked == "false" ]]; then # This is a user-added background, move it to user config user_theme_bg_dir="$USER_BACKGROUNDS_DIR/$theme_name" mkdir -p "$user_theme_bg_dir" @@ -49,7 +49,7 @@ if [[ -L $CURRENT_THEME_LINK ]]; then CURRENT_THEME_NAME=$(basename "$(readlink "$CURRENT_THEME_LINK")") elif [[ -d $CURRENT_THEME_LINK ]]; then CURRENT_THEME_NAME=$(basename "$CURRENT_THEME_LINK") -elif [[ -f "$HOME/.config/omarchy/current/theme.name" ]]; then +elif [[ -f $HOME/.config/omarchy/current/theme.name ]]; then CURRENT_THEME_NAME=$(cat "$HOME/.config/omarchy/current/theme.name") fi diff --git a/migrations/1770159912.sh b/migrations/1770159912.sh index 5709cdb7..41d8115d 100644 --- a/migrations/1770159912.sh +++ b/migrations/1770159912.sh @@ -6,7 +6,7 @@ NVIDIA="$(lspci | grep -i 'nvidia')" if echo "$NVIDIA" | grep -qE "GTX (9[0-9]{2}|10[0-9]{2})|GT 10[0-9]{2}|Quadro [PM][0-9]{3,4}|Quadro GV100|MX *[0-9]+|Titan (X|Xp|V)|Tesla V100"; then ENVS_CONF="$HOME/.config/hypr/envs.conf" - if [ -f "$ENVS_CONF" ]; then + if [[ -f $ENVS_CONF ]]; then # Check if file contains problematic variables if grep -qE "env = (NVD_BACKEND,direct|LIBVA_DRIVER_NAME,nvidia)" "$ENVS_CONF"; then echo "Removing incompatible NVIDIA environment variables for legacy GPU..." diff --git a/migrations/1771403119.sh b/migrations/1771403119.sh index fb27c296..a9bfa18f 100644 --- a/migrations/1771403119.sh +++ b/migrations/1771403119.sh @@ -1,3 +1,3 @@ echo "Cure Chromium crash bug caused by mixing 145 and 144 sync logs" -rm -rf ~/.config/chromium/Default/Sync\ Data/LevelDB/*.log +rm -rf ~/.config/chromium/Default/"Sync Data"/LevelDB/*.log