Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Use these instead of raw shell commands:
- `omarchy-pkg-drop` - remove packages; use this instead of raw `pacman -R*`
- `omarchy-notification-send` - send desktop notifications; do not call `notify-send` directly
- `omarchy-hw-asus-rog` - detect ASUS ROG hardware (and similar `hw-*` commands)
- `omarchy-hw-arch` / `omarchy-hw-aarch64` / `omarchy-hw-apple-silicon` - architecture and Apple Silicon detection; do not call `uname -m` or grep `/proc/device-tree/compatible` in install or runtime code. `omarchy-mac-setup` may read `uname -m` because it can run from `curl | bash` before the checkout exists. Historical migrations keep their original checks.

Commands installed by Omarchy's default package set are runtime invariants. Invoke them directly; do not add defensive `omarchy-cmd-present` / `omarchy-cmd-missing` checks around them. Use command-presence helpers only for genuinely optional dependencies or code that can run before the default package set is installed.

Expand Down
2 changes: 1 addition & 1 deletion bin/omarchy-capture-screenrecording
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ REC_PID=""
# so use wf-recorder there. Elsewhere prefer gpu-screen-recorder, falling back to
# wf-recorder only if gpu-screen-recorder isn't installed.
select_recorder_backend() {
if grep -qa apple /proc/device-tree/compatible 2>/dev/null; then
if omarchy-hw-apple-silicon; then
echo "wf-recorder"
elif omarchy-cmd-present gpu-screen-recorder; then
echo "gpu-screen-recorder"
Expand Down
2 changes: 1 addition & 1 deletion bin/omarchy-hibernation-setup
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ done

# Apple Silicon / Asahi: resume path is Limine-oriented and hibernate is
# unreliable; never create swap or limine drop-ins on aarch64 (even with --force).
if [[ $(uname -m) == "aarch64" ]]; then
if omarchy-hw-aarch64; then
echo "Skipping hibernation setup (not supported on aarch64 / Omarchy Mac)"
exit 0
fi
Expand Down
10 changes: 10 additions & 0 deletions bin/omarchy-hw-aarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# omarchy:summary=Detect whether the machine is aarch64.

# Codebase split: pacman tree, installer, package filter, aarch64-only tools.
# Self-contained so bootstrap can invoke it by absolute path before PATH is set.
case ${OMARCHY_UNAME_M:-$(uname -m)} in
aarch64 | arm64) exit 0 ;;
esac
exit 1
12 changes: 12 additions & 0 deletions bin/omarchy-hw-apple-silicon
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# omarchy:summary=Detect Apple Silicon (Asahi) hardware.

# Hardware split: notch, Asahi HID, vulkan-asahi, wf-recorder, asahi-audio.
# aarch64 is not enough — a Raspberry Pi must not take the Apple path.
# OMARCHY_APPLE_COMPATIBLE stubs the device-tree file for tests.
case ${OMARCHY_UNAME_M:-$(uname -m)} in
aarch64 | arm64) ;;
*) exit 1 ;;
esac
grep -qi apple "${OMARCHY_APPLE_COMPATIBLE:-/proc/device-tree/compatible}" 2>/dev/null
12 changes: 12 additions & 0 deletions bin/omarchy-hw-arch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# omarchy:summary=Print the canonical machine architecture (aarch64 or x86_64).

# Maps uname's arm64 alias; unsupported or failed detection returns no name.
# OMARCHY_UNAME_M stubs uname for tests (same idea as OMARCHY_PCI_DEVICES_PATH).
arch="${OMARCHY_UNAME_M:-$(uname -m)}" || exit 1
case $arch in
aarch64 | arm64) printf '%s\n' aarch64 ;;
x86_64) printf '%s\n' x86_64 ;;
*) exit 1 ;;
esac
8 changes: 7 additions & 1 deletion bin/omarchy-hw-laptop
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ done
# button. 8=Portable 9=Laptop 10=Notebook 14=Sub Notebook 30=Tablet
# 31=Convertible 32=Detachable.
chassis_type=""
read -r chassis_type <"${OMARCHY_DMI_CHASSIS_TYPE_PATH:-/sys/class/dmi/id/chassis_type}" 2>/dev/null || true
dmi_chassis="${OMARCHY_DMI_CHASSIS_TYPE_PATH:-/sys/class/dmi/id/chassis_type}"
[[ -f $dmi_chassis ]] && read -r chassis_type <"$dmi_chassis" || true
case "$chassis_type" in
8 | 9 | 10 | 14 | 30 | 31 | 32) exit 0 ;;
esac

# Asahi MacBooks often expose neither an ACPI lid nor DMI chassis_type.
# Only fall back when DMI said nothing — an explicit desktop chassis (Mac
# Studio, Mini, or a test stub) must not be overridden by Apple Silicon.
[[ -z $chassis_type ]] && omarchy-hw-apple-silicon && exit 0

exit 1
2 changes: 1 addition & 1 deletion bin/omarchy-install-1password
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ INSTALL_DIR="/opt/1Password"
BIN_LINK="/usr/local/bin/1password"

# Only run on aarch64
if [ "$(uname -m)" != "aarch64" ]; then
if [[ $(omarchy-hw-arch) != "aarch64" ]]; then
echo "Skipping: 1Password aarch64 installer only runs on aarch64 architecture"
exit 0
fi
Expand Down
2 changes: 1 addition & 1 deletion bin/omarchy-install-cursor
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
set -euo pipefail

VERSION="2.6.20"
ARCH="$(uname -m)"
ARCH="$(omarchy-hw-arch)"
CURSOR_DIR="/opt/cursor"
CURSOR_APPIMAGE="$CURSOR_DIR/cursor.AppImage"
CURSOR_BIN="/usr/local/bin/cursor"
Expand Down
2 changes: 1 addition & 1 deletion bin/omarchy-install-docker-dbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

options=("MySQL" "PostgreSQL" "Redis" "MongoDB" "MariaDB")

if [[ $(uname -m) == "x86_64" ]]; then
if [[ $(omarchy-hw-arch) == "x86_64" ]]; then
options+=("MSSQL")
fi

Expand Down
2 changes: 1 addition & 1 deletion bin/omarchy-install-gaming-steam
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ echo "Installing Steam..."
omarchy-pkg-add steam
omarchy-install-gaming-gpu-lib32

if [[ $(uname -m) == aarch64 ]]; then
if omarchy-hw-aarch64; then
omarchy-launch-steam --prepare
fi

Expand Down
2 changes: 1 addition & 1 deletion bin/omarchy-install-preinstalls
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if gum confirm "Are you sure you want to restore all preinstalled web apps, TUI
omacalc
omawrite
)
if [[ $(uname -m) == "aarch64" ]]; then
if omarchy-hw-aarch64; then
preinstall_packages+=(obsidian-appimage)
fi

Expand Down
2 changes: 1 addition & 1 deletion bin/omarchy-install-service-1password
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ install_chromium_extension() {
}

echo "Installing 1Password..."
if [[ $(uname -m) == "aarch64" ]]; then
if omarchy-hw-aarch64; then
# The AUR PKGBUILD is x86_64-only, so omarchy-pkg-add fails outright here.
# omarchy-install-1password takes the official arm64 tarball instead.
omarchy-install-1password
Expand Down
4 changes: 2 additions & 2 deletions bin/omarchy-launch-steam
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ PY
}

prepare_asahi() {
[[ $(uname -m) == aarch64 ]] || return 0
omarchy-hw-aarch64 || return 0
write_steam_desktop
patch_steam_ui
}
Expand All @@ -86,7 +86,7 @@ if [[ ${1:-} == --prepare ]]; then
exit 0
fi

if [[ $(uname -m) == aarch64 ]] && omarchy-cmd-present muvm && omarchy-cmd-present FEXBash; then
if omarchy-hw-aarch64 && omarchy-cmd-present muvm && omarchy-cmd-present FEXBash; then
launcher="$HOME/.local/share/fex-steam/steam-launcher/bin_steam.sh"

if [[ -f $launcher ]]; then
Expand Down
38 changes: 20 additions & 18 deletions bin/omarchy-pkg-add
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,32 @@
# omarchy:examples=omarchy pkg add jq ripgrep
# omarchy:requires-sudo=true

# Mac fork: upstream migrations sometimes install packages that don't exist in
# Arch Linux ARM's repos (e.g. x86-only packages). Filter to what is actually
# installable here so those installs skip cleanly with a warning instead of
# hard-failing the whole migration.
to_install=()
for pkg in "$@"; do
if pacman -Q "$pkg" &>/dev/null || pacman -Si "$pkg" &>/dev/null; then
to_install+=("$pkg")
else
echo -e "\033[33mSkipping '$pkg': not available in the repos on this system\033[0m" >&2
fi
done

((${#to_install[@]})) || exit 0
# On aarch64, upstream migrations sometimes name packages Arch Linux ARM does
# not serve. Filter to what is installable so those skip with a warning instead
# of failing the whole transaction. On x86 this is a no-op: missing packages
# fail, matching upstream.
packages=("$@")
if omarchy-hw-aarch64; then
packages=()
for pkg in "$@"; do
if pacman -Q "$pkg" &>/dev/null || pacman -Si "$pkg" &>/dev/null; then
packages+=("$pkg")
else
echo -e "\033[33mSkipping '$pkg': not available in the repos on this system\033[0m" >&2
fi
done
((${#packages[@]})) || exit 0
fi

if omarchy-pkg-missing "${to_install[@]}"; then
if omarchy-pkg-missing "${packages[@]}"; then
if (( EUID == 0 )); then
pacman -S --noconfirm --needed "${to_install[@]}" || exit 1
pacman -S --noconfirm --needed "${packages[@]}" || exit 1
else
sudo pacman -S --noconfirm --needed "${to_install[@]}" || exit 1
sudo pacman -S --noconfirm --needed "${packages[@]}" || exit 1
fi
fi

for pkg in "${to_install[@]}"; do
for pkg in "${packages[@]}"; do
# Secondary check to handle states where pacman doesn't actually register an error
if ! pacman -Q "$pkg" &>/dev/null; then
echo -e "\033[31mError: Package '$pkg' did not install\033[0m" >&2
Expand Down
18 changes: 9 additions & 9 deletions bin/omarchy-pkg-publish-aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
# self-hosted git server is up. It went down mid-install once and took the
# whole desktop with it, because there is no Quattro shell without quickshell.
#
# The fix is the repo that already exists. default/pacman/pacman-stable.conf
# points pacman at a GitHub release serving a real pacman database, and this
# publishes into it: build on this machine, add to the database, upload.
# The fix is the repo that already exists under default/pacman/aarch64/.
# Its stable config points pacman at a GitHub release serving a real pacman
# database, and this publishes into it: build on this machine, add to the database, upload.
# Installs then fetch a binary instead of building one.
#
# Run it on Apple Silicon as your regular user, with gh logged in to the
Expand All @@ -31,10 +31,10 @@ readonly checkout="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
find_pacman_conf() {
local candidate
for candidate in \
"$checkout/default/pacman/pacman-stable.conf" \
"${OMARCHY_PATH:-}/default/pacman/pacman-stable.conf" \
"$HOME/.local/share/omarchy/default/pacman/pacman-stable.conf" \
/usr/share/omarchy/default/pacman/pacman-stable.conf \
"$checkout/default/pacman/aarch64/pacman-stable.conf" \
"${OMARCHY_PATH:-}/default/pacman/aarch64/pacman-stable.conf" \
"$HOME/.local/share/omarchy/default/pacman/aarch64/pacman-stable.conf" \
/usr/share/omarchy/default/pacman/aarch64/pacman-stable.conf \
/etc/pacman.conf; do
[[ -n $candidate && -f $candidate ]] || continue
grep -q '^\[omarchy-aarch64\]' "$candidate" || continue
Expand Down Expand Up @@ -151,8 +151,8 @@ main() {
(( ${#built[@]} )) || fail "no packages in $from_dir"
else
(( ${#packages[@]} )) || packages=(quickshell-git)
[[ $(uname -m) == "aarch64" ]] ||
fail "building runs on Apple Silicon; use --from to publish packages built elsewhere"
omarchy-hw-aarch64 ||
fail "building runs on aarch64; use --from to publish packages built elsewhere"
command -v makepkg >/dev/null || fail "makepkg is required (install base-devel)"

local build_dir="$work_root/build"
Expand Down
24 changes: 17 additions & 7 deletions bin/omarchy-refresh-pacman
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@

sudo cp -f /etc/pacman.conf /etc/pacman.conf.bak
sudo cp -f /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
if [[ -f /etc/pacman.d/mirrorlist.asahi-alarm ]]; then
sudo cp -f /etc/pacman.d/mirrorlist.asahi-alarm /etc/pacman.d/mirrorlist.asahi-alarm.bak
fi

channel="${1:-stable}"

Expand All @@ -19,16 +16,29 @@ fi
echo "Setting channel to $channel"
echo

sudo cp -f "$OMARCHY_PATH/default/pacman/pacman-$channel.conf" /etc/pacman.conf
sudo cp -f "$OMARCHY_PATH/default/pacman/mirrorlist" /etc/pacman.d/mirrorlist
sudo cp -f "$OMARCHY_PATH/default/pacman/mirrorlist.asahi-alarm" /etc/pacman.d/mirrorlist.asahi-alarm
if omarchy-hw-aarch64; then
pacman_dir="$OMARCHY_PATH/default/pacman/aarch64"
mirrorlist_src="$pacman_dir/mirrorlist"
if [[ -f /etc/pacman.d/mirrorlist.asahi-alarm ]]; then
sudo cp -f /etc/pacman.d/mirrorlist.asahi-alarm /etc/pacman.d/mirrorlist.asahi-alarm.bak
fi
else
pacman_dir="$OMARCHY_PATH/default/pacman"
mirrorlist_src="$pacman_dir/mirrorlist-$channel"
fi

sudo cp -f "$pacman_dir/pacman-$channel.conf" /etc/pacman.conf
sudo cp -f "$mirrorlist_src" /etc/pacman.d/mirrorlist
if omarchy-hw-aarch64; then
sudo cp -f "$pacman_dir/mirrorlist.asahi-alarm" /etc/pacman.d/mirrorlist.asahi-alarm
fi

# Allow user customization of /etc/pacman.conf before the upgrade runs
omarchy-hook pre-refresh-pacman

# Reset all package DBs and then update
targets=()
if [[ $(uname -m) == "aarch64" ]]; then
if omarchy-hw-aarch64; then
source "$OMARCHY_PATH/install/helpers/arm-package-sources.sh"
# Keep the original configuration saved before the channel replacement.
omarchy_arm_prepare_package_sources /etc/pacman.conf preserve-backup || exit 1
Expand Down
17 changes: 15 additions & 2 deletions bin/omarchy-refresh-pacman-mirrorlist
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,21 @@
# missing from the system file. This avoids removing Arch Linux ARM or user-added
# mirrors while still making Omarchy's recommended servers available.

SRC="$OMARCHY_PATH/default/pacman/mirrorlist"
ASAHI_SRC="$OMARCHY_PATH/default/pacman/mirrorlist.asahi-alarm"
if omarchy-hw-aarch64; then
SRC="$OMARCHY_PATH/default/pacman/aarch64/mirrorlist"
ASAHI_SRC="$OMARCHY_PATH/default/pacman/aarch64/mirrorlist.asahi-alarm"
else
pacman_conf="${OMARCHY_PACMAN_CONF_PATH:-/etc/pacman.conf}"
channel=stable
for candidate in stable rc edge; do
if grep -qF "https://pkgs.omarchy.org/$candidate/" "$pacman_conf" 2>/dev/null; then
channel="$candidate"
break
fi
done
SRC="$OMARCHY_PATH/default/pacman/mirrorlist-$channel"
ASAHI_SRC=""
fi
DEST="/etc/pacman.d/mirrorlist"
ASAHI_DEST="/etc/pacman.d/mirrorlist.asahi-alarm"

Expand Down
2 changes: 1 addition & 1 deletion bin/omarchy-remove-preinstalls
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if gum confirm "Are you sure you want to remove all preinstalled web apps, TUI w
omacalc
omawrite
)
if [[ $(uname -m) == "aarch64" ]]; then
if omarchy-hw-aarch64; then
Comment thread
malik-na marked this conversation as resolved.
preinstall_packages+=(obsidian-appimage)
fi
omarchy-pkg-drop "${preinstall_packages[@]}"
Expand Down
2 changes: 1 addition & 1 deletion bin/omarchy-system-boot-to-esp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ main() {
done

(( EUID == 0 )) || fail "run as root"
[[ $(uname -m) == "aarch64" ]] || fail "this tool is for Apple Silicon (aarch64) installs"
omarchy-hw-apple-silicon || fail "this tool is for Apple Silicon installs"

if findmnt -no SOURCE /boot >/dev/null 2>&1; then
log "/boot is already its own mount -- nothing to do."
Expand Down
2 changes: 1 addition & 1 deletion bin/omarchy-system-btrfs-migrate
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ run_stage() {
local encrypt="$1"

(( EUID == 0 )) || fail "run as root"
[[ $(uname -m) == aarch64 ]] || fail "this tool is for Apple Silicon (aarch64) installs"
omarchy-hw-apple-silicon || fail "this tool is for Apple Silicon installs"
[[ -f ${BASH_SOURCE[0]} ]] || fail "run this from a file, not via a pipe (curl -O it first)"
[[ -d /boot/grub ]] || fail "no GRUB found at /boot/grub; unsupported boot layout"

Expand Down
2 changes: 1 addition & 1 deletion bin/omarchy-update-keyring
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

set -e

if [[ $(uname -m) == "aarch64" ]]; then
if omarchy-hw-aarch64; then
source "$OMARCHY_PATH/install/helpers/arm-package-sources.sh"
omarchy_arm_prepare_package_sources
# Refresh the distribution keyring before the immediately following full
Expand Down
Loading
Loading