Start the starship prompt and build it from the active theme

This commit is contained in:
2026-09-21 01:07:27 +00:00
parent e74c9c5bc1
commit 64afc07250
8 changed files with 74 additions and 12 deletions
@@ -1,31 +1,41 @@
add_newline = true
command_timeout = 200
format = "[$directory$git_branch$git_status]($style)$character"
palette = "blob"
[palettes.blob]
accent = "{{ accent }}"
foreground = "{{ foreground }}"
muted = "{{ muted }}"
success = "{{ green }}"
warning = "{{ yellow }}"
error = "{{ red }}"
[character]
error_symbol = "[✗](bold cyan)"
success_symbol = "[](bold cyan)"
error_symbol = "[✗](bold error)"
success_symbol = "[](bold accent)"
[directory]
style = "foreground"
truncation_length = 2
truncation_symbol = "…/"
repo_root_style = "bold cyan"
repo_root_style = "bold accent"
repo_root_format = "[$repo_root]($repo_root_style)[$path]($style)[$read_only]($read_only_style) "
[git_branch]
format = "[$branch]($style) "
style = "italic cyan"
style = "italic accent"
[git_status]
format = '[$all_status]($style)'
style = "cyan"
style = "warning"
ahead = "⇡${count} "
diverged = "⇕⇡${ahead_count}⇣${behind_count} "
behind = "⇣${count} "
conflicted = " "
up_to_date = " "
conflicted = " "
up_to_date = " "
untracked = "? "
modified = " "
modified = " "
stashed = ""
staged = ""
renamed = ""
+4
View File
@@ -42,6 +42,10 @@ with `--check`.
panels come up full of blanks. `fonts.conf` binds `monospace` to
`JetBrainsMono Nerd Font`; `blob font set` rewrites the same file, and the
installer then reports it as a local change and keeps your choice.
`~/.bashrc` gets one line sourcing `session/bashrc`, which is what starts
the starship prompt and puts `blob` on `PATH` in an interactive shell. The
line is added once, a `.bak` is kept, and a `~/.bashrc` that already has it
is left alone.
`session/profile.sh` also goes to `/etc/profile.d/blob.sh`, which sources
`session/env-bootstrap` and is what puts `blob` on `PATH` in a login shell.
Without it `BLOB_PATH` and `$BLOB_PATH/bin` are only set by
+19 -4
View File
@@ -30,12 +30,13 @@ the shell and the CLI never disagree about what a slot means.
Each rendered file is picked up differently: `foot.ini` and `kitty.conf` by an
`include` in the shipped terminal config, `hyprland.lua` through Hyprland's Lua
module path, `shell.toml` and `chromium.theme` read straight from the state
directory, and `btop.theme`, `neovim.lua` and `gtk.css` through symlinks the
installer makes into those apps' own config trees.
directory, and `btop.theme`, `neovim.lua`, `gtk.css` and `starship.toml`
through symlinks the installer makes into those apps' own config trees.
`default/themed/*.tpl` are rendered per theme into
`~/.local/state/blob/current/theme/`. Ten ship: foot, kitty, btop, chromium,
hyprland, the screenshare picker, neovim, `shell.toml`, zen, and `gtk.css`.
`~/.local/state/blob/current/theme/`. Eleven ship: foot, kitty, btop, chromium,
hyprland, the screenshare picker, neovim, `shell.toml`, zen, `gtk.css`, and
`starship.toml`.
An app picks its colors up in one of two ways. Most include the generated file
directly, so nothing has to run:
@@ -65,6 +66,20 @@ so an app that was already open keeps its old colors until it is restarted.
Adding a template for another app means dropping a `.tpl` in `default/themed/`
and, if it cannot include a file, adding an applier to that list.
## The prompt
`starship.toml` is linked to `~/.config/starship.toml`. It carries a
`[palettes.blob]` block built from the theme - `accent`, `foreground`, `muted`,
`success`, `warning`, `error` - and every style in the file names one of those
rather than a literal color, so the prompt moves with the theme. Starship reads
its config on each prompt, so a theme change shows up on the next command, in
shells that are already open.
`starship init bash` runs from `session/bashrc`, which `install.sh` sources from
`~/.bashrc` with a single line. That file returns immediately in a
non-interactive shell, so it cannot disturb `scp` or `rsync`, and it also
sources `session/env-bootstrap` so `blob` is on `PATH` in any interactive shell.
## The three ways to set a theme
| Command | Does |
+1
View File
@@ -65,6 +65,7 @@ install_packages
install_shipped_config
refresh_font_cache
install_shell_profile
install_bash_integration
install_user_units
install_systemd_dropins
install_zen_config
+21
View File
@@ -63,6 +63,27 @@ install_shipped_config() {
install_file "$repo_dir/fonts/omarchy.ttf" "$font_dir/omarchy.ttf" "fonts/omarchy.ttf"
}
bashrc_line='[ -r "$HOME/.local/share/blob/session/bashrc" ] && . "$HOME/.local/share/blob/session/bashrc"'
install_bash_integration() {
local bashrc="$HOME/.bashrc"
if [[ -f $bashrc ]] && grep -Fqx "$bashrc_line" "$bashrc"; then
say "ok bashrc"
return 0
fi
note_change
if [[ $check == true ]]; then
say "would source session/bashrc from ~/.bashrc"
return 0
fi
[[ -f $bashrc ]] && cp "$bashrc" "$bashrc.bak"
printf '\n%s\n' "$bashrc_line" >>"$bashrc"
say "write bashrc"
}
refresh_font_cache() {
if ! command -v fc-cache &>/dev/null; then
say "SKIP font cache (fc-cache not installed)"
+1
View File
@@ -133,6 +133,7 @@ link_app_themes() {
link_theme_file btop.theme "$config_dir/btop/themes/current.theme" "btop theme"
link_theme_file gtk.css "$config_dir/gtk-3.0/gtk.css" "gtk-3.0 theme"
link_theme_file gtk.css "$config_dir/gtk-4.0/gtk.css" "gtk-4.0 theme"
link_theme_file starship.toml "$config_dir/starship.toml" "starship prompt"
if [[ -d $config_dir/nvim/lua/plugins ]]; then
link_theme_file neovim.lua "$config_dir/nvim/lua/plugins/theme.lua" "neovim theme"
+8
View File
@@ -0,0 +1,8 @@
case $- in
*i*) ;;
*) return 0 ;;
esac
[ -r "$HOME/.local/share/blob/session/env-bootstrap" ] && . "$HOME/.local/share/blob/session/env-bootstrap"
command -v starship >/dev/null 2>&1 && eval "$(starship init bash)"
+2
View File
@@ -112,6 +112,8 @@ for lua in hyprland.lua monitors.lua input.lua looknfeel.lua bindings.lua autost
restore_or_remove "$config_dir/hypr/$lua" "hypr/$lua"
done
[[ -L $config_dir/starship.toml ]] && restore_or_remove "$config_dir/starship.toml" "starship.toml"
for gtk in gtk-3.0 gtk-4.0; do
[[ -L $config_dir/$gtk/gtk.css ]] && restore_or_remove "$config_dir/$gtk/gtk.css" "$gtk/gtk.css"
done