Files
dotfiles/script/omarchy-theme-set-vscode
T
gitadmin fb52016257 feat: add omarchy theme template system with management scripts
- New default/themed/ templates (alacritty, btop, foot, ghostty, helix,
  hyprland, hyprlock, kitty, mako, obsidian, rofi, swayosd, tmux,
  walker, waybar, keyboard.rgb, gum.env, etc.)
- Add omarchy-* theme management scripts (install, refresh, set, remove,
  update, bg-set, colors-from-alacritty, current, etc.)
- Add omarchy restart/hook scripts (btop, hyprctl, hypridle, mako, tmux)
- Add installer/environment.sh for shared env vars
- Add 19 theme directories with colors.toml, vscode.json, backgrounds,
  and app-specific configs (catppuccin, everforest, gruvbox, nord,
  tokyo-night, rose-pine, etc.)
- Update bing-wallpaper script to use new .config/omarchy path
2026-07-08 15:31:04 -04:00

41 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# omarchy:summary=Sync Omarchy theme to VS Code, VSCodium, and Cursor
# omarchy:hidden=true
VS_CODE_THEME="$HOME/.config/omarchy/current/theme/vscode.json"
set_theme() {
local editor_cmd="$1"
local settings_path="$2"
omarchy-cmd-present "$editor_cmd" || return 0
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 2>/dev/null | grep -Fxq "$extension"; then
"$editor_cmd" --install-extension "$extension" >/dev/null 2>&1
fi
mkdir -p "$(dirname "$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"
fi
sed -i --follow-symlinks -E \
"s/(\"workbench.colorTheme\"[[:space:]]*:[[:space:]]*\")[^\"]*(\")/\1$theme_name\2/" \
"$settings_path"
elif [[ -f $settings_path ]]; then
sed -i --follow-symlinks -E 's/\"workbench\.colorTheme\"[[:space:]]*:[^,}]*,?//' "$settings_path"
fi
}
! omarchy-toggle-enabled skip-vscode-theme-changes && set_theme "code" "$HOME/.config/Code/User/settings.json"
! omarchy-toggle-enabled skip-vscode-insiders-theme-changes && set_theme "code-insiders" "$HOME/.config/Code - Insiders/User/settings.json"
! omarchy-toggle-enabled skip-codium-theme-changes && set_theme "codium" "$HOME/.config/VSCodium/User/settings.json"
! omarchy-toggle-enabled skip-cursor-theme-changes && set_theme "cursor" "$HOME/.config/Cursor/User/settings.json"