Let a theme name hold a plus or lead with an underscore, and document the set
The name a theme installs under is derived from its repo URL, and holding it to an allowlist made that allowlist a naming convention nobody had written down. It was also tighter than the harm it exists to stop: `+` is not shell syntax and a leading `_` is neither the `..` climb nor the dash basename reads as an option, so `omarchy-c++-theme` was refused for nothing. Widen the set to those two and say what it is where a theme author is already picking a name. The leading character stays out of `.` and `-`, which is the part that does the work. Reported-by: Luis Alvarez (lalvarezt) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fd3RCHxwjEbMXoSYB9Aiso
This commit is contained in:
co-authored by
Claude Opus 5
parent
75e51f0b95
commit
3b0e899029
@@ -37,7 +37,7 @@ THEME_PATH="$THEMES_DIR/$THEME_NAME"
|
||||
# ~/.config/omarchy with it, and one called `a';'id` would carry its own
|
||||
# command into that picker. The leading character is kept out of `.` and `-`,
|
||||
# which also covers `host:-s/foo.git` leaving basename with `.git`.
|
||||
if [[ ! $THEME_NAME =~ ^[a-z0-9][a-z0-9._-]*$ ]]; then
|
||||
if [[ ! $THEME_NAME =~ ^[a-z0-9_][a-z0-9._+-]*$ ]]; then
|
||||
echo "Error: '$REPO_URL' does not give a usable theme name."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -38,6 +38,8 @@ There's a fully commented `alacritty.toml.tpl.sample` in that folder to copy fro
|
||||
|
||||
If you want to distribute your theme so others can use it, you need to put it on a public git server, like GitHub. Then people can install it using _Install > Style > Theme_ in the Omarchy menu using that URL. It's recommended that you follow the naming convention of `omarchy-[themename]-theme`, as the theme will show correctly as just `[themename]` in the theme selection menu after installation.
|
||||
|
||||
That leftover `[themename]` becomes the theme's directory name, so it has to be one Omarchy can hand around safely: it must start with a letter, a digit, or an underscore, and the rest may hold letters, digits, `.`, `_`, `+`, and `-`. Capitals are lowercased for you, but anything else — a space, a quote, a non-English character — is refused at install time rather than turned into a directory name. So `omarchy-tokyo-night-theme`, `omarchy-flexoki_light-theme`, and `omarchy-c++-theme` all install fine.
|
||||
|
||||
Remember that once it's installed from a repo, any `.lua`, terminal config or `vscode.json` it ships is dropped, so don't build the theme around those.
|
||||
|
||||
You can have your theme added to [the extra themes page](https://omarchy.org/themes/) by sending a pull request to [the omarchy-site repo](https://github.com/omacom-io/omarchy-site).
|
||||
|
||||
@@ -120,6 +120,21 @@ grep -Fq "/themes/tokyo_night.2" "$git_calls" ||
|
||||
|
||||
pass "a theme name may still hold an underscore, a dot, and a dash"
|
||||
|
||||
# A plus is neither path-climb nor shell syntax, and a leading underscore is
|
||||
# neither the `..` climb nor the dash that reads as an option, so the allowlist
|
||||
# keeps both rather than stranding a repo that names itself with them.
|
||||
install_theme "https://github.com/example/omarchy-c++-theme.git" ||
|
||||
fail "omarchy-theme-install accepts a name holding a plus"
|
||||
grep -Fq "/themes/c++" "$git_calls" ||
|
||||
fail "omarchy-theme-install derives a name carrying a plus" "$(cat "$git_calls")"
|
||||
|
||||
install_theme "https://github.com/example/_private.git" ||
|
||||
fail "omarchy-theme-install accepts a name starting with an underscore"
|
||||
grep -Fq "/themes/_private" "$git_calls" ||
|
||||
fail "omarchy-theme-install derives a name starting with an underscore" "$(cat "$git_calls")"
|
||||
|
||||
pass "a plus and a leading underscore are still usable theme names"
|
||||
|
||||
# basename reads a leading dash as an option once the scp-style prefix is gone.
|
||||
install_theme "host:-s/foo.git" || fail "omarchy-theme-install accepts a normal scp-style URL"
|
||||
grep -Fq -- "-- host:-s/foo.git" "$git_calls" || fail "omarchy-theme-install passes the URL after --" "$(cat "$git_calls")"
|
||||
|
||||
Reference in New Issue
Block a user