Skip to content
Closed
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
25 changes: 25 additions & 0 deletions bin/omarchy-theme-set
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,31 @@ else
gsettings set org.gnome.desktop.interface icon-theme "Yaru-blue"
fi

# Set Zed theme if installed (check for both zed and zeditor commands)
if (command -v zed &>/dev/null || command -v zeditor &>/dev/null) && [[ -f "$CURRENT_THEME_DIR/zed.json" ]]; then
mkdir -p ~/.config/zed/themes
ln -nsf "$CURRENT_THEME_DIR/zed.json" ~/.config/zed/themes/omarchy-current.json

# Update Zed's settings.json using sed (preserves comments and formatting)
ZED_SETTINGS="$HOME/.config/zed/settings.json"
if [[ -f "$ZED_SETTINGS" ]]; then
if grep -q '"theme"' "$ZED_SETTINGS"; then
sed -i 's/"theme"\s*:\s*"[^"]*"/"theme": "Omarchy Current"/g' "$ZED_SETTINGS"
else
# Add theme setting before the closing brace
sed -i '$s/}/ "theme": "Omarchy Current"\n}/' "$ZED_SETTINGS"
fi
else
# Create new settings.json with theme only if file doesn't exist
echo '{
"theme": "Omarchy Current"
}' > "$ZED_SETTINGS"
fi

# Touch the theme file to trigger Zed's file watcher for theme reload
touch ~/.config/zed/themes/omarchy-current.json
fi

# Trigger alacritty config reload
touch "$HOME/.config/alacritty/alacritty.toml"

Expand Down
6 changes: 6 additions & 0 deletions install/desktop/theme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ ln -snf ~/.config/omarchy/current/theme/btop.theme ~/.config/btop/themes/current

mkdir -p ~/.config/mako
ln -snf ~/.config/omarchy/current/theme/mako.ini ~/.config/mako/config

# Setup Zed theme link if Zed is installed (check for both zed and zeditor commands)
if command -v zed &>/dev/null || command -v zeditor &>/dev/null; then
mkdir -p ~/.config/zed/themes
ln -snf ~/.config/omarchy/current/theme/zed.json ~/.config/zed/themes/omarchy-current.json
fi
54 changes: 54 additions & 0 deletions migrations/1754959324.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

# Migration: Add Zed editor theme support
# This migration sets up Zed theme integration with pre-generated theme files

echo "🎨 Adding Zed editor theme support..."

# Setup Zed theme link if Zed is installed
if command -v zed &>/dev/null || command -v zeditor &>/dev/null; then
echo " Setting up Zed theme integration..."

# Create Zed themes directory
mkdir -p ~/.config/zed/themes

# Link current theme if it exists
if [[ -f ~/.config/omarchy/current/theme/zed.json ]]; then
ln -snf ~/.config/omarchy/current/theme/zed.json ~/.config/zed/themes/omarchy-current.json

# Update Zed settings to use the theme
ZED_SETTINGS="$HOME/.config/zed/settings.json"
if [[ -f "$ZED_SETTINGS" ]]; then
# Use Python to safely update the JSON
python3 -c "
import json
import sys

settings_file = '$ZED_SETTINGS'
try:
with open(settings_file, 'r') as f:
settings = json.load(f)
except (FileNotFoundError, json.JSONDecodeError):
settings = {}

# Update theme setting
settings['theme'] = 'Omarchy Current'

# Write back with nice formatting
with open(settings_file, 'w') as f:
json.dump(settings, f, indent=2)
" 2>/dev/null || true
else
# Create new settings.json with theme
echo '{
"theme": "Omarchy Current"
}' > "$ZED_SETTINGS"
fi

echo " ✅ Zed theme integration complete"
fi
else
echo " ℹ️ Zed not installed, skipping Zed theme setup"
fi

echo "✨ Zed editor theme support migration complete!"
Loading