Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
45 changes: 45 additions & 0 deletions bin/omarchy-theme-color
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,50 @@ parse_colors_file() {
return 0
}

resolve_terminal_settings() {
local blur="${THEME_COLORS[terminal_blur]:-false}"
local opacity="${THEME_COLORS[terminal_opacity]:-1.0}"
local radius="${THEME_COLORS[terminal_blur_radius]:-20}"

# These settings are scalar, so anything after the value is a TOML comment.
opacity="${opacity%%#*}"
opacity="${opacity%% *}"
blur="${blur%%#*}"
blur="${blur%% *}"
radius="${radius%%#*}"
radius="${radius%% *}"
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved

if [[ ! $opacity =~ ^(0([.][0-9]+)?|1([.]0+)?)$ ]]; then
printf 'omarchy-theme-color: invalid terminal_opacity %q; using 1.0\n' "$opacity" >&2
opacity="1.0"
fi

if [[ $blur != "true" && $blur != "false" ]]; then
printf 'omarchy-theme-color: invalid terminal_blur %q; using false\n' "$blur" >&2
blur="false"
fi

if [[ ! $radius =~ ^[0-9]{1,2}$ ]] || (( 10#$radius > 64 )); then
printf 'omarchy-theme-color: invalid terminal_blur_radius %q; using 20\n' "$radius" >&2
radius=20
else
radius=$((10#$radius))
fi

THEME_COLORS[terminal_opacity]="$opacity"
THEME_COLORS[terminal_blur]="$blur"

if [[ $blur == "true" ]]; then
THEME_COLORS[terminal_blur_radius]="$radius"
THEME_COLORS[terminal_blur_foot]="yes"
THEME_COLORS[terminal_blur_ghostty]="$radius"
else
THEME_COLORS[terminal_blur_radius]="0"
THEME_COLORS[terminal_blur_foot]="no"
THEME_COLORS[terminal_blur_ghostty]="false"
fi
}

resolve_theme_colors() {
local key

Expand Down Expand Up @@ -277,6 +321,7 @@ resolve_theme_colors() {
done

resolve_theme_mode
resolve_terminal_settings
THEME_COLORS[theme_type]="${THEME_COLORS[mode]}"
}

Expand Down
13 changes: 11 additions & 2 deletions bin/omarchy-theme-set
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,18 @@ mkdir -p "$NEXT_THEME_PATH"
# Copy official theme first, then overlay the user's theme on top
cp -r "$OMARCHY_THEMES_PATH/$THEME_NAME/"* "$NEXT_THEME_PATH/" 2>/dev/null

HYPRLAND_LUA_FROM_STOCK=0
if [[ -f $NEXT_THEME_PATH/hyprland.lua ]]; then
HYPRLAND_LUA_FROM_STOCK=1
fi

if theme_came_from_a_repo "$USER_THEMES_PATH/$THEME_NAME"; then
stage_installed_theme "$USER_THEMES_PATH/$THEME_NAME"
report_ignored_theme_files
else
if [[ -e $USER_THEMES_PATH/$THEME_NAME/hyprland.lua || -L $USER_THEMES_PATH/$THEME_NAME/hyprland.lua ]]; then
HYPRLAND_LUA_FROM_STOCK=0
fi
cp -r "$USER_THEMES_PATH/$THEME_NAME/"* "$NEXT_THEME_PATH/" 2>/dev/null
fi

Expand Down Expand Up @@ -386,8 +394,9 @@ if [[ $THEME_HEADLESS != "1" && $OMARCHY_THEME_SKIP_BACKGROUND != "1" ]]; then
fi
fi

# Generate dynamic configs
omarchy-theme-set-templates
# Generate dynamic configs. A declarative user overlay may extend bundled Lua,
# while a trusted user-supplied hyprland.lua remains authoritative.
OMARCHY_THEME_HYPRLAND_LUA_FROM_STOCK="$HYPRLAND_LUA_FROM_STOCK" omarchy-theme-set-templates

# Swap next theme in as current
rm -rf "$CURRENT_THEME_PATH"
Expand Down
Loading