/ de-omarchy / bin / omarchy-plymouth-set-by-theme
swadhinbiswas Initial de-omarchy: Omarchy UI layer for Arch-based distros · 8/22/2026
9f393b2
54 lines · 1.1 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
#!/bin/bash

# omarchy:summary=Set the Plymouth boot theme from an Omarchy theme
# omarchy:args=<theme-name>
# omarchy:requires-sudo=true

# Resolve a theme by name and apply its unlock.png + colors.toml as the
# Plymouth boot screen via omarchy-plymouth-set.

if (( $# != 1 )); then
  echo "Usage: omarchy-plymouth-set-by-theme <theme-name>" >&2
  exit 1
fi

theme=$1

theme_dir=$(omarchy-theme-dir "$theme")

theme_color() {
  local key="$1"
  local fallback="$2"

  awk -F= -v key="$key" -v fallback="$fallback" '
    function clean(raw) {
      gsub(/^[[:space:]]+|[[:space:]]+$/, "", raw)
      if (raw ~ /^"/) {
        sub(/^"/, "", raw)
        sub(/".*$/, "", raw)
      }
      return raw
    }

    {
      field = $1
      gsub(/^[[:space:]]+|[[:space:]]+$/, "", field)
      if (field == key) {
        print clean($2)
        found = 1
        exit
      }
      if (field == fallback) fallback_value = clean($2)
    }

    END {
      if (!found && fallback_value != "") print fallback_value
    }
  ' "$theme_dir/colors.toml"
}

bg=$(theme_color background)
text=$(theme_color foreground)

exec omarchy-plymouth-set "$bg" "$text" "$theme_dir/unlock.png"