This commit is contained in:
2026-11-04 20:35:46 +01:00
parent 5f4de5e60c
commit 86abc097f4
348 changed files with 10300 additions and 0 deletions
@@ -0,0 +1,9 @@
{
"files": {
"README.md": "c971168a3f8d5a0c570c8a7813760655",
"apply.sh": "72fdf03821d232593cf85ea926253472",
"bat.tmTheme": "48ce50cbdc345e4a61d8a3dc95b4fce8",
"template.toml": "6ee484a55483e12300a00641ec38aecc"
},
"version": 1
}
@@ -0,0 +1,9 @@
# bat
Adds a Noctalia syntax-highlighting theme for bat.
Enable **bat** in **Noctalia Settings -> Templates**. The template writes `$XDG_CONFIG_HOME/bat/themes/noctalia.tmTheme` (`~/.config/bat/themes/noctalia.tmTheme` by default).
The Bash post-hook creates `$XDG_CONFIG_HOME/bat/config` if necessary and selects `--theme=noctalia`. Unless that exact line is already present, it removes existing lines beginning with `--theme=` before appending the new selection. Back up your config first; no backup is created.
Install `bat` or `batcat`: the hook runs the available executable with `cache --build` after generation. If neither exists, it prints a warning; run `bat cache --build` (or `batcat cache --build`) yourself after installation.
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -euo pipefail
bat_config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/bat"
themes_dir="$bat_config_dir/themes"
config_file="$bat_config_dir/config"
theme_file="$themes_dir/noctalia.tmTheme"
theme_line="--theme=noctalia"
mkdir -p "$themes_dir"
touch "$config_file" "$theme_file"
write_if_changed() {
local target="$1" tmp="$2"
if ! cmp -s "$target" "$tmp"; then
cat "$tmp" >"$target"
fi
rm -f "$tmp"
}
if ! grep -Fxq -- "$theme_line" "$config_file"; then
tmp_file="$(mktemp "${config_file}.tmp.XXXXXX")"
sed '/^--theme=/d' "$config_file" >"$tmp_file"
[ -s "$tmp_file" ] && [ -n "$(tail -c1 "$tmp_file")" ] && echo >>"$tmp_file"
printf '%s\n' "$theme_line" >>"$tmp_file"
write_if_changed "$config_file" "$tmp_file"
fi
if command -v bat >/dev/null 2>&1; then
bat cache --build
elif command -v batcat >/dev/null 2>&1; then
batcat cache --build
else
echo "Warning: 'bat' executable not found. Please run 'bat cache --build' manually once it is installed."
fi
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,8 @@
[catalog.bat]
name = "bat"
category = "terminal"
[templates.bat]
input_path = "bat.tmTheme"
output_path = "$XDG_CONFIG_HOME/bat/themes/noctalia.tmTheme"
post_hook = "bash '{{ config_dir }}/apply.sh'"