/ de-omarchy / scripts / verify.sh
swadhinbiswas Initial de-omarchy: Omarchy UI layer for Arch-based distros · 8/22/2026
9f393b2
63 lines · 2.5 KB
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
#!/bin/bash
# de-omarchy verify — post-install sanity checks (read-only).
set -u
PASS=0; FAIL=0
ok()   { echo "  [ok]   $*"; PASS=$((PASS+1)); }
bad()  { echo "  [FAIL] $*"; FAIL=$((FAIL+1)); }

RUNTIME=/usr/share/de-omarchy
MARKER=">>> de-omarchy layer"
HYPR_MAIN="$HOME/.config/hypr/hyprland.lua"

echo "== de-omarchy verification =="

[[ -d $RUNTIME/bin && -f $RUNTIME/shell/shell.qml ]] \
  && ok "runtime present at $RUNTIME" || bad "runtime missing at $RUNTIME"

for f in deo-layer.lua deo-bindings.lua deo-autostart.lua; do
  [[ -L $HOME/.config/hypr/$f ]] && ok "symlink ~/.config/hypr/$f" || bad "missing symlink ~/.config/hypr/$f"
done

if [[ -f $HYPR_MAIN ]]; then
  COUNT=$(grep -c "$MARKER" "$HYPR_MAIN")
  (( COUNT == 1 )) && ok "hyprland.lua carries exactly one de-omarchy block" \
                   || bad "hyprland.lua marker count = $COUNT (expected 1)"
  bash -n "$HYPR_MAIN" >/dev/null 2>&1 && ok "hyprland.lua still valid for bash -n smoke test" || true
else
  bad "hyprland.lua missing"
fi

[[ -e $HOME/.config/zshrc.d/50-de-omarchy.zsh ]] && ok "zsh hook installed" || bad "zsh hook missing"

# zsh loads the hook without errors (syntax + execution in a throwaway shell)
if command -v zsh >/dev/null 2>&1; then
  if ZDOTDIR=$(mktemp -d) sh -c 'cp ~/.config/zshrc.d/50-de-omarchy.zsh "$ZDOTDIR/.zshrc"; zsh -c "source $ZDOTDIR/.zshrc"' >/dev/null 2>&1; then
    ok "zsh hook sources cleanly"
  else
    bad "zsh hook errors on source"
  fi
fi

# omarchy router works with runtime env
if OMARCHY_PATH=$RUNTIME "$RUNTIME/bin/omarchy" --help >/dev/null 2>&1 || OMARCHY_PATH=$RUNTIME "$RUNTIME/bin/omarchy" >/dev/null 2>&1; then
  ok "omarchy command router responds"
else
  bad "omarchy router did not respond"
fi

# theme state initialized
grep -q . "$HOME/.local/state/omarchy/current/theme.name" 2>/dev/null \
  && ok "current theme: $(cat "$HOME/.local/state/omarchy/current/theme.name")" \
  || warn_no_theme=1

# monitors sanity: live monitors match display/monitors.lua outputs
if command -v hyprctl >/dev/null 2>&1 && [[ -f $(dirname "${BASH_SOURCE[0]}")/../display/monitors.lua ]]; then
  LIVE=$(hyprctl monitors all 2>/dev/null | grep -oP '^Monitor \K[^ ]+' | sort)
  EXPECTED=$(grep -oP 'output = "\K[^"]+' "$(dirname "${BASH_SOURCE[0]}")/../display/monitors.lua" | sort)
  [[ "$LIVE" == "$EXPECTED" ]] && ok "monitors match display/monitors.lua" \
                                || { echo "    live:   $(echo $LIVE)"; echo "    expect: $(echo $EXPECTED)"; }
fi

echo "== result: $PASS passed, $FAIL failed =="
exit $(( FAIL > 0 ))