From bc2ceb5e52214c7c8baa76adcfb71931df31bfc0 Mon Sep 17 00:00:00 2001 From: rain Date: Mon, 22 Jun 2026 14:26:01 -0400 Subject: [PATCH] Make sway hostname match support suffix forms (byte-arch etc.) The previous `has .chezmoi.hostname ` only matched exact strings. byte's hostname is `byte-arch` (set by the CachyOS installer), so it didn't match the `byte` entry in the allowlist and got sway=false. New logic: hostname matches if it equals any entry OR starts with '-' or '.'. So 'byte', 'byte-arch', and 'byte.foo' all match the 'byte' entry. --- .chezmoi.yaml.tmpl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.chezmoi.yaml.tmpl b/.chezmoi.yaml.tmpl index 263965e..b840cc1 100644 --- a/.chezmoi.yaml.tmpl +++ b/.chezmoi.yaml.tmpl @@ -76,6 +76,15 @@ data: {{- else if $swayOverrideOff }} sway: false {{- else }} + {{- /* Hostname allowlist for the desktop stack. Match if hostname + equals or starts with any of the listed prefixes (e.g. "byte" + matches both "byte" and "byte-arch"). */}} {{- $swayHosts := list "miche" "byte" "kaiser" }} - sway: {{ has .chezmoi.hostname $swayHosts }} + {{- $swayMatch := false }} + {{- range $swayHosts }} + {{- if or (eq . $.chezmoi.hostname) (hasPrefix (printf "%s-" .) $.chezmoi.hostname) (hasPrefix (printf "%s." .) $.chezmoi.hostname) }} + {{- $swayMatch = true }} + {{- end }} + {{- end }} + sway: {{ $swayMatch }} {{- end }} \ No newline at end of file