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
2 changes: 1 addition & 1 deletion bin/omarchy-restart-opencode
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# omarchy:summary=Reload opencode configuration (used by the Omarchy theme switching).
# omarchy:summary=Reload opencode configuration

if pgrep -x opencode >/dev/null; then
killall -SIGUSR2 opencode
Expand Down
2 changes: 1 addition & 1 deletion bin/omarchy-theme-set
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ post_theme_commands=(
omarchy-restart-terminal
omarchy-restart-hyprctl
omarchy-restart-btop
omarchy-restart-opencode
omarchy-restart-helix
omarchy-theme-set-foot
omarchy-theme-set-tmux
omarchy-theme-set-opencode
omarchy-theme-set-gnome
omarchy-theme-set-pi
omarchy-theme-set-browser
Expand Down
21 changes: 21 additions & 0 deletions bin/omarchy-theme-set-opencode
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# omarchy:summary=Apply the current Omarchy theme to running OpenCode TUIs
# omarchy:hidden=true

COLORS_TOML="$HOME/.local/state/omarchy/current/theme/colors.toml"

[[ -f $COLORS_TOML ]] || exit 0

theme_osc=$(omarchy-theme-osc "$COLORS_TOML")
[[ -n $theme_osc ]] || exit 0

declare -A seen_ttys
for pid in $(pgrep -x opencode 2>/dev/null || true); do
tty=$(readlink "/proc/$pid/fd/1" 2>/dev/null)
[[ $tty == /dev/pts/* ]] || continue
[[ ${seen_ttys[$tty]:-} ]] && continue
seen_ttys[$tty]=1

printf '%b\033[?996n' "$theme_osc" 2>/dev/null >"$tty" || true
done