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
101 changes: 64 additions & 37 deletions bin/omarchy-font-set
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,71 @@
# Set the system-wide monospace font that should be used by the terminal, hyprlock, waybar, swayosd, etc.
# The font name must be one of the ones returned by omarchy-font-list.

set -e

font_name="$1"

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
fi

if [[ -f ~/.config/kitty/kitty.conf ]]; then
sed -i "s/^font_family .*/font_family $font_name/g" ~/.config/kitty/kitty.conf
pkill -USR1 kitty
fi

if [[ -f ~/.config/ghostty/config ]]; then
sed -i "s/font-family = \".*\"/font-family = \"$font_name\"/g" ~/.config/ghostty/config
pkill -SIGUSR2 ghostty
fi

sed -i "s/font_family = .*/font_family = $font_name/g" ~/.config/hypr/hyprlock.conf
sed -i "s/font-family: .*/font-family: '$font_name';/g" ~/.config/waybar/style.css
sed -i "s/font-family: .*/font-family: '$font_name';/g" ~/.config/swayosd/style.css
xmlstarlet ed -L \
-u '//match[@target="pattern"][test/string="monospace"]/edit[@name="family"]/string' \
-v "$font_name" \
~/.config/fontconfig/fonts.conf

omarchy-restart-waybar
omarchy-restart-swayosd

if pgrep -x ghostty; then
notify-send " You must restart Ghostty to see font change"
fi

omarchy-hook font-set "$font_name"
else
echo "Font '$font_name' not found."
exit 1
fi
else
if [[ -z "$font_name" ]]; then
echo "Usage: omarchy-font-set <font-name>"
exit 1
fi

validate_font() {
if ! fc-list | grep -iq "$1"; then
echo "Font '$1' not found." >&2
echo "Use 'omarchy-font-list' to see available fonts." >&2
return 1
fi
}

update_alacritty() {
local font="$1"
if [[ -f ~/.config/alacritty/alacritty.toml ]]; then
sed -i "s/family = \".*\"/family = \"$font\"/g" ~/.config/alacritty/alacritty.toml
fi
}

update_kitty() {
local font="$1"
if [[ -f ~/.config/kitty/kitty.conf ]]; then
sed -i "s/^font_family .*/font_family $font/g" ~/.config/kitty/kitty.conf
pkill -USR1 kitty 2>/dev/null || true
fi
}

update_ghostty() {
local font="$1"
if [[ -f ~/.config/ghostty/config ]]; then
sed -i "s/font-family = \".*\"/font-family = \"$font\"/g" ~/.config/ghostty/config
pkill -SIGUSR2 ghostty 2>/dev/null || true
fi
}

update_system_configs() {
local font="$1"
sed -i "s/font_family = .*/font_family = $font/g" ~/.config/hypr/hyprlock.conf
sed -i "s/font-family: .*/font-family: '$font';/g" ~/.config/waybar/style.css
sed -i "s/font-family: .*/font-family: '$font';/g" ~/.config/swayosd/style.css
xmlstarlet ed -L \
-u '//match[@target="pattern"][test/string="monospace"]/edit[@name="family"]/string' \
-v "$font" \
~/.config/fontconfig/fonts.conf
}

restart_components() {
omarchy-restart-waybar
omarchy-restart-swayosd

if pgrep -x ghostty >/dev/null 2>&1; then
notify-send " You must restart Ghostty to see font change"
fi
}

validate_font "$font_name"
update_alacritty "$font_name"
update_kitty "$font_name"
update_ghostty "$font_name"
update_system_configs "$font_name"
restart_components

omarchy-hook font-set "$font_name"
9 changes: 8 additions & 1 deletion bin/omarchy-install-dev-env
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

# Install one of the supported development environments. Usually called via Install > Development > * in the Omarchy Menu.

SUPPORTED_ENVS="ruby|node|bun|deno|go|php|laravel|symfony|python|elixir|phoenix|rust|java|zig|ocaml|dotnet|clojure"

if [[ -z "$1" ]]; then
echo "Usage: omarchy-install-dev-env <ruby|node|bun|go|laravel|symfony|php|python|elixir|phoenix|rust|java|ocaml|dotnet|clojure>" >&2
echo "Usage: omarchy-install-dev-env <$SUPPORTED_ENVS>" >&2
exit 1
fi

Expand Down Expand Up @@ -141,4 +143,9 @@ clojure)
omarchy-pkg-add rlwrap
mise use --global clojure@latest
;;
*)
echo "Unknown environment: $1" >&2
echo "Usage: omarchy-install-dev-env <$SUPPORTED_ENVS>" >&2
exit 1
;;
esac
65 changes: 55 additions & 10 deletions bin/omarchy-migrate
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,66 @@ mkdir -p "$STATE_DIR"
# Skipped migrations are tracked separately
mkdir -p "$STATE_DIR/skipped"

# Count pending migrations for progress reporting
count_pending_migrations() {
local count=0
for file in ~/.local/share/omarchy/migrations/*.sh; do
[[ -f "$file" ]] || continue
local filename
filename=$(basename "$file")
if [[ ! -f "$STATE_DIR/$filename" && ! -f "$STATE_DIR/skipped/$filename" ]]; then
((count++))
fi
done
echo "$count"
}

# Run a single migration file and record its result
run_migration() {
local file="$1"
local filename
filename=$(basename "$file")
local migration_id="${filename%.sh}"

echo -e "\e[32m\nRunning migration ($migration_id)\e[0m"

if bash "$file"; then
touch "$STATE_DIR/$filename"
return 0
fi

echo -e "\e[31mMigration $migration_id failed\e[0m" >&2

if command -v gum &>/dev/null && gum confirm "Migration $migration_id failed. Skip and continue?"; then
touch "$STATE_DIR/skipped/$filename"
return 0
fi

return 1
}

# Run any pending migrations
pending=$(count_pending_migrations)

if [[ "$pending" -eq 0 ]]; then
exit 0
fi

completed=0

for file in ~/.local/share/omarchy/migrations/*.sh; do
[[ -f "$file" ]] || continue
filename=$(basename "$file")

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
touch "$STATE_DIR/$filename"
else
if gum confirm "Migration ${filename%.sh} failed. Skip and continue?"; then
touch "$STATE_DIR/skipped/$filename"
else
exit 1
fi
if ! run_migration "$file"; then
echo -e "\e[31mMigration aborted. $completed/$pending migrations completed.\e[0m" >&2
exit 1
fi
((completed++))
fi
done

if [[ "$completed" -gt 0 ]]; then
echo -e "\e[32m\nAll $completed migrations completed successfully.\e[0m"
fi
27 changes: 23 additions & 4 deletions bin/omarchy-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,31 @@ COMMAND="$1"
OMARCHY_PATH=${OMARCHY_PATH:-$HOME/.local/share/omarchy}

if [[ -z $COMMAND ]]; then
echo "Usage: omarchy-snapshot <create|restore>" >&2
echo "Usage: omarchy-snapshot <create|restore|delete>" >&2
exit 1
fi

if ! command -v snapper &>/dev/null; then
exit 127 # omarchy-update can use this to just ignore if snapper is not available
fi

# Retrieve all snapper config names from CSV output
get_snapper_configs() {
mapfile -t CONFIGS < <(sudo snapper --csvout list-configs | awk -F, 'NR>1 {print $1}')

if [[ ${#CONFIGS[@]} -eq 0 ]]; then
echo "No snapper configs found" >&2
return 1
fi
}

case "$COMMAND" in
create)
DESC="$(omarchy-version)"

echo -e "\e[32mCreate system snapshot\e[0m"

# Get existing snapper config names from CSV output
mapfile -t CONFIGS < <(sudo snapper --csvout list-configs | awk -F, 'NR>1 {print $1}')
get_snapper_configs || exit 1

for config in "${CONFIGS[@]}"; do
sudo snapper -c "$config" create -c number -d "$DESC"
Expand All @@ -32,5 +41,15 @@ restore)
sudo limine-snapper-restore
;;
delete)
sudo snapper -c "$config" delete 0
get_snapper_configs || exit 1

for config in "${CONFIGS[@]}"; do
sudo snapper -c "$config" delete 0
done
;;
*)
echo "Unknown command: $COMMAND" >&2
echo "Usage: omarchy-snapshot <create|restore|delete>" >&2
exit 1
;;
esac
66 changes: 51 additions & 15 deletions bin/omarchy-theme-install
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,67 @@
# omarchy-theme-install: Install a new theme from a git repo for Omarchy
# Usage: omarchy-theme-install <git-repo-url>

if [ -z "$1" ]; then
set -e

THEMES_DIR="$HOME/.config/omarchy/themes"

validate_repo_url() {
local url="$1"
if [[ ! "$url" =~ ^https?:// ]] && [[ ! "$url" =~ ^git@ ]]; then
echo "Error: Invalid repository URL. Must start with https:// or git@" >&2
return 1
fi
}

extract_theme_name() {
local url="$1"
basename "$url" .git | sed -E 's/^omarchy-//; s/-theme$//'
}

clone_theme() {
local url="$1"
local dest="$2"

# Remove existing theme if present
if [[ -d "$dest" ]]; then
echo "Replacing existing theme at $dest"
rm -rf "$dest"
fi

if ! git clone "$url" "$dest" 2>&1; then
echo "Error: Failed to clone theme repo from $url" >&2
return 1
fi
}

validate_theme_contents() {
local theme_path="$1"
local theme_name="$2"

if [[ ! -f "$theme_path/colors.toml" ]]; then
echo "Warning: Theme '$theme_name' is missing colors.toml — it may not work correctly." >&2
fi
}

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

THEMES_DIR="$HOME/.config/omarchy/themes"
THEME_NAME=$(basename "$REPO_URL" .git | sed -E 's/^omarchy-//; s/-theme$//')
THEME_PATH="$THEMES_DIR/$THEME_NAME"
validate_repo_url "$REPO_URL"

# Remove existing theme if present
if [ -d "$THEME_PATH" ]; then
rm -rf "$THEME_PATH"
fi
THEME_NAME=$(extract_theme_name "$REPO_URL")
THEME_PATH="$THEMES_DIR/$THEME_NAME"

# Clone the repo directly to ~/.config/omarchy/themes
if ! git clone "$REPO_URL" "$THEME_PATH"; then
echo "Error: Failed to clone theme repo."
exit 1
fi
mkdir -p "$THEMES_DIR"
clone_theme "$REPO_URL" "$THEME_PATH"
validate_theme_contents "$THEME_PATH" "$THEME_NAME"

# Apply the new theme with omarchy-theme-set
omarchy-theme-set $THEME_NAME
omarchy-theme-set "$THEME_NAME"
Loading