swadhinbiswas Initial de-omarchy: Omarchy UI layer for Arch-based distros · 8/22/2026
9f393b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash
# omarchy:summary=Sync current Omarchy theme environment into tmux
# omarchy:hidden=true
CURRENT_THEME_PATH="$HOME/.local/state/omarchy/current/theme"
GUM_ENV="$CURRENT_THEME_PATH/gum_env.lua"
COLORS_TOML="$CURRENT_THEME_PATH/colors.toml"
if ! tmux list-sessions >/dev/null 2>&1; then
exit 0
fi
set_tmux_environment() {
local key="$1"
local value="$2"
local session
tmux set-environment -g "$key" "$value" 2>/dev/null || return 0
while IFS= read -r session; do
[[ -n $session ]] || continue
tmux set-environment -t "$session" "$key" "$value" 2>/dev/null || true
done < <(tmux list-sessions -F "#{session_id}" 2>/dev/null)
}
sync_theme_environment() {
local key value
[[ -f $GUM_ENV ]] || return
while IFS=$'\t' read -r key value; do
[[ -n $key && -n $value ]] || continue
set_tmux_environment "$key" "$value"
done < <(awk -F'"' '/hl\.env\("[A-Z0-9_]+", "[^"]+"\)/ { print $2 "\t" $4 }' "$GUM_ENV")
}
sync_colorfgbg() {
local colorfgbg="15;0"
# theme_color resolves mode from colors.toml, a legacy light.mode file, or
# background luminance, so a bare light check covers all theme styles.
if [[ $(theme_color mode) == "light" ]]; then
colorfgbg="0;15"
fi
set_tmux_environment COLORFGBG "$colorfgbg"
}
theme_osc_sequences() {
omarchy-theme-osc "$COLORS_TOML"
}
theme_color() {
omarchy-theme-color --file "$COLORS_TOML" "$@"
}
sync_tmux_window_style() {
local background foreground cursor
[[ -f $COLORS_TOML ]] || return
foreground=$(theme_color foreground)
background=$(theme_color background)
cursor=$(theme_color cursor)
[[ -n $foreground && -n $background ]] || return
tmux set-option -g window-style "fg=$foreground,bg=$background" 2>/dev/null || true
tmux set-option -g window-active-style "fg=$foreground,bg=$background" 2>/dev/null || true
# Apps like nvim clear the per-pane cursor colour with OSC 112. Without a
# global fallback, tmux then resets the outer terminal's cursor, which in
# terminals that can't reload their config (foot) restores the colour from
# whatever theme was active when the terminal launched.
if [[ -n $cursor ]]; then
tmux set-option -g cursor-colour "$cursor" 2>/dev/null || true
fi
}
sync_tmux_pane_colors() {
local pane_tty theme_osc
[[ -f $COLORS_TOML ]] || return
theme_osc=$(theme_osc_sequences)
[[ -n $theme_osc ]] || return
while IFS= read -r pane_tty; do
[[ $pane_tty == /dev/pts/* ]] || continue
printf '%b' "$theme_osc" >"$pane_tty" 2>/dev/null || true
done < <(tmux list-panes -a -F "#{pane_tty}" 2>/dev/null | sort -u)
}
signal_tmux_panes() {
local pane_tty tpgid
while IFS= read -r pane_tty; do
[[ $pane_tty == /dev/pts/* ]] || continue
tpgid=$(ps -o tpgid= -t "${pane_tty#/dev/}" 2>/dev/null | awk 'NF && $1 > 0 { print $1; exit }')
[[ -n $tpgid ]] || continue
kill -WINCH "-$tpgid" 2>/dev/null || true
done < <(tmux list-panes -a -F "#{pane_tty}" 2>/dev/null | sort -u)
}
refresh_tmux_clients() {
local client
while IFS= read -r client; do
[[ -n $client ]] || continue
tmux refresh-client -t "$client" 2>/dev/null || true
done < <(tmux list-clients -F "#{client_name}" 2>/dev/null)
}
sync_theme_environment
sync_colorfgbg
sync_tmux_window_style
sync_tmux_pane_colors
signal_tmux_panes
refresh_tmux_clients