Use consistent bash5 style for conditionals and quoting

This commit is contained in:
David Heinemeier Hansson
2026-02-21 10:18:47 +01:00
parent d2acf3b6ba
commit 7514ae7dcf
113 changed files with 289 additions and 287 deletions
+5 -1
View File
@@ -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
+2 -2
View File
@@ -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
+3 -3
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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)"
+6 -6
View File
@@ -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.
+6 -6
View File
@@ -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
+1 -1
View File
@@ -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"
+10 -10
View File
@@ -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
+6 -6
View File
@@ -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
+1 -1
View File
@@ -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
+4 -4
View File
@@ -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 ""
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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 <<<encrypted_drives) == 1 )); then
drive_to_change="$encrypted_drives"
else
drive_to_change="$(omarchy-drive-select "$encrypted_drives")"
+1 -1
View File
@@ -5,7 +5,7 @@
font_name="$1"
if [[ -n "$font_name" ]]; then
if [[ -n $font_name ]]; then
if fc-list | grep -iq "$font_name"; then
if [[ -f ~/.config/alacritty/alacritty.toml ]]; then
sed -i "s/family = \".*\"/family = \"$font_name\"/g" ~/.config/alacritty/alacritty.toml
+1 -1
View File
@@ -11,7 +11,7 @@ SWAPSIZE=$(( 1024 * ${SWAPSIZE_KB:-0} ))
HIBERNATION_IMAGE_SIZE=$(cat /sys/power/image_size)
if [[ "$SWAPSIZE" -gt "$HIBERNATION_IMAGE_SIZE" ]] && [[ -f /etc/mkinitcpio.conf.d/omarchy_resume.conf ]]; then
if (( SWAPSIZE > HIBERNATION_IMAGE_SIZE )) && [[ -f /etc/mkinitcpio.conf.d/omarchy_resume.conf ]]; then
exit 0
else
exit 1
+2 -2
View File
@@ -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
+3 -3
View File
@@ -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
+1 -1
View File
@@ -4,7 +4,7 @@
set -e
if [[ $# -lt 1 ]]; then
if (( $# < 1 )); then
echo "Usage: omarchy-hook [name] [args...]"
exit 1
fi
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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."
+2 -2
View File
@@ -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 ;;
@@ -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"
+1 -1
View File
@@ -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"
+15 -15
View File
@@ -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
+6 -7
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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
+2 -2
View File
@@ -5,7 +5,7 @@
config_file=$1
if [[ -z "$config_file" ]]; then
if [[ -z $config_file ]]; then
cat <<USAGE
Usage: $0 [config_file]
@@ -22,7 +22,7 @@ user_config_file="${HOME}/.config/$config_file"
default_config_file="${HOME}/.local/share/omarchy/config/$config_file"
backup_config_file="$user_config_file.bak.$(date +%s)"
if [[ -f "$user_config_file" ]]; then
if [[ -f $user_config_file ]]; then
# Create preliminary backup
cp -f "$user_config_file" "$backup_config_file" 2>/dev/null
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -3,7 +3,7 @@
# Remove a development environment that was previously installed via omarchy-install-dev-env.
# Usage: omarchy-remove-dev-env <ruby|node|bun|deno|go|php|laravel|symfony|python|elixir|phoenix|zig|rust|java|dotnet|ocaml|clojure|scala>
if [[ -z "$1" ]]; then
if [[ -z $1 ]]; then
echo "Usage: omarchy-remove-dev-env <ruby|node|bun|deno|go|php|laravel|symfony|python|elixir|phoenix|zig|rust|java|dotnet|ocaml|clojure|scala>" >&2
exit 1
fi
+1 -1
View File
@@ -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" \
+2 -2
View File
@@ -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
+7 -7
View File
@@ -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"
+5 -5
View File
@@ -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
+2 -2
View File
@@ -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 <set|clear> <state-name-or-pattern>"
exit 1
fi
if [[ -z "$STATE_NAME" ]]; then
if [[ -z $STATE_NAME ]]; then
echo "Usage: omarchy-state $COMMAND <state-name>"
exit 1
fi
+1 -1
View File
@@ -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')" \
+1 -1
View File
@@ -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')" \
+4 -4
View File
@@ -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
+1 -1
View File
@@ -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 <path-to-image>" >&2
exit 1
fi
+3 -3
View File
@@ -3,14 +3,14 @@
# omarchy-theme-install: Install a new theme from a git repo for Omarchy
# Usage: omarchy-theme-install <git-repo-url>
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
+4 -4
View File
@@ -3,10 +3,10 @@
# omarchy-theme-remove: Remove a theme from Omarchy by name
# Usage: omarchy-theme-remove <theme-name>
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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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#\#}"
+3 -3
View File
@@ -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",
+5 -5
View File
@@ -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
}
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
@@ -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
+4 -4
View File
@@ -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
+3 -3
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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
+2 -2
View File
@@ -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
+3 -3
View File
@@ -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"
+5 -5
View File
@@ -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 ""
+2 -2
View File
@@ -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
+3 -3
View File
@@ -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
+1 -1
View File
@@ -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
+26 -26
View File
@@ -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" \
+2 -2
View File
@@ -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
@@ -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
@@ -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 <<EOF | sudo tee /etc/systemd/system/omarchy-nvme-suspend-fix.service >/dev/null
@@ -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
@@ -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"
+2 -2
View File
@@ -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
@@ -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
+4 -4
View File
@@ -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'
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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/')
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+4 -4
View File
@@ -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
+8 -8
View File
@@ -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
+3 -3
View File
@@ -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 </dev/tty)
if [ -n "$TERM_SIZE" ]; then
if [[ -n $TERM_SIZE ]]; then
export TERM_HEIGHT=$(echo "$TERM_SIZE" | cut -d' ' -f1)
export TERM_WIDTH=$(echo "$TERM_SIZE" | cut -d' ' -f2)
else
@@ -25,7 +25,7 @@ export LOGO_PATH="$OMARCHY_PATH/logo.txt"
export LOGO_WIDTH=$(awk '{ if (length > 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
+4 -4
View File
@@ -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//')" \
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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 <<EOF | sudo tee /etc/sddm.conf.d/autologin.conf
[Autologin]
User=$USER
+2 -2
View File
@@ -13,7 +13,7 @@ echo
if [[ -f $OMARCHY_INSTALL_LOG_FILE ]] && grep -q "Total:" "$OMARCHY_INSTALL_LOG_FILE" 2>/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
+2 -2
View File
@@ -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
+4 -4
View File
@@ -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"
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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"
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+2 -3
View File
@@ -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

Some files were not shown because too many files have changed in this diff Show More