Theme fastfetch from the active palette
This commit is contained in:
@@ -12,9 +12,11 @@ LOGO_FILE="$HOME/.config/blob/branding/about.txt"
|
||||
FIT_FILE="$HOME/.local/state/blob/windows/about.fit"
|
||||
|
||||
# A user-level fastfetch config can relocate or restyle the logo in ways this
|
||||
# measurement cannot see, so leave sizing to the float rule in that case.
|
||||
# measurement cannot see, so leave sizing to the float rule in that case. Blob's
|
||||
# own config is the symlink the installer makes into the current theme, and the
|
||||
# measurements below are written against it.
|
||||
custom_fastfetch_config() {
|
||||
[[ -f $HOME/.config/fastfetch/config.jsonc ]]
|
||||
[[ -f $HOME/.config/fastfetch/config.jsonc && ! -L $HOME/.config/fastfetch/config.jsonc ]]
|
||||
}
|
||||
|
||||
# wc -L counts display columns only in a UTF-8 locale. A session that never set
|
||||
|
||||
@@ -203,6 +203,7 @@ add_template_value() {
|
||||
if [[ $value =~ ^#[0-9A-Fa-f]{6}$ ]]; then
|
||||
rgb=$(hex_to_rgb "$value")
|
||||
printf 's|{{ %s_rgb }}|%s|g\n' "$key" "$rgb" >>"$sed_script"
|
||||
printf 's|{{ %s_ansi }}|38;2;%s|g\n' "$key" "${rgb//,/;}" >>"$sed_script"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"logo": {
|
||||
"type": "file",
|
||||
"source": "~/.config/blob/branding/about.txt",
|
||||
"padding": {
|
||||
"top": 2,
|
||||
"left": 2,
|
||||
"right": 6
|
||||
}
|
||||
},
|
||||
"display": {
|
||||
"separator": " ",
|
||||
"key": {
|
||||
"width": 9
|
||||
},
|
||||
"color": {
|
||||
"title": "{{ accent_ansi }}",
|
||||
"keys": "{{ accent_ansi }}",
|
||||
"output": "{{ foreground_ansi }}"
|
||||
}
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"type": "title",
|
||||
"format": "{user-name}@{host-name}"
|
||||
},
|
||||
"break",
|
||||
{ "type": "os", "key": "os" },
|
||||
{ "type": "kernel", "key": "kernel" },
|
||||
{ "type": "uptime", "key": "uptime" },
|
||||
{ "type": "packages", "key": "packages" },
|
||||
{ "type": "shell", "key": "shell" },
|
||||
"break",
|
||||
{ "type": "wm", "key": "wm" },
|
||||
{ "type": "terminal", "key": "term" },
|
||||
{ "type": "display", "key": "display" },
|
||||
"break",
|
||||
{ "type": "cpu", "key": "cpu" },
|
||||
{ "type": "gpu", "key": "gpu" },
|
||||
{ "type": "memory", "key": "memory" },
|
||||
{ "type": "disk", "key": "disk" },
|
||||
"break",
|
||||
{
|
||||
"type": "colors",
|
||||
"symbol": "circle",
|
||||
"paddingLeft": 9
|
||||
}
|
||||
]
|
||||
}
|
||||
+24
-5
@@ -30,13 +30,14 @@ 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`, `gtk.css` and `starship.toml`
|
||||
through symlinks the installer makes into those apps' own config trees.
|
||||
directory, and `btop.theme`, `neovim.lua`, `gtk.css`, `starship.toml` and
|
||||
`fastfetch.jsonc` through symlinks the installer makes into those apps' own
|
||||
config trees.
|
||||
|
||||
`default/themed/*.tpl` are rendered per theme into
|
||||
`~/.local/state/blob/current/theme/`. Eleven ship: foot, kitty, btop, chromium,
|
||||
hyprland, the screenshare picker, neovim, `shell.toml`, zen, `gtk.css`, and
|
||||
`starship.toml`.
|
||||
`~/.local/state/blob/current/theme/`. Twelve ship: foot, kitty, btop, chromium,
|
||||
hyprland, the screenshare picker, neovim, `shell.toml`, zen, `gtk.css`,
|
||||
`starship.toml`, and `fastfetch.jsonc`.
|
||||
|
||||
An app picks its colors up in one of two ways. Most include the generated file
|
||||
directly, so nothing has to run:
|
||||
@@ -66,6 +67,24 @@ 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.
|
||||
|
||||
## Tokens
|
||||
|
||||
A template may reference `{{ key }}` for any resolved palette key, plus three
|
||||
derived forms: `{{ key_strip }}` without the leading `#`, `{{ key_rgb }}` as
|
||||
`R,G,B`, and `{{ key_ansi }}` as `38;2;R;G;B`, which is what a terminal program
|
||||
that takes a raw escape sequence rather than a hex color needs.
|
||||
|
||||
## About
|
||||
|
||||
`fastfetch.jsonc` is linked to `~/.config/fastfetch/config.jsonc`. It draws
|
||||
`~/.config/blob/branding/about.txt` as the logo, with 2 columns of padding to
|
||||
its left and 6 between it and the modules - the exact numbers
|
||||
`blob-launch-about` measures the About window against, so replacing the logo
|
||||
resizes the window to fit it. Title and keys take the theme's accent.
|
||||
|
||||
A config of your own at that path is a regular file rather than the symlink, and
|
||||
`blob-launch-about` leaves the window sizing alone when it finds one.
|
||||
|
||||
## The prompt
|
||||
|
||||
`starship.toml` is linked to `~/.config/starship.toml`. It carries a
|
||||
|
||||
@@ -134,6 +134,7 @@ link_app_themes() {
|
||||
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"
|
||||
link_theme_file fastfetch.jsonc "$config_dir/fastfetch/config.jsonc" "fastfetch"
|
||||
|
||||
if [[ -d $config_dir/nvim/lua/plugins ]]; then
|
||||
link_theme_file neovim.lua "$config_dir/nvim/lua/plugins/theme.lua" "neovim theme"
|
||||
|
||||
@@ -114,6 +114,7 @@ for lua in hyprland.lua monitors.lua input.lua looknfeel.lua bindings.lua autost
|
||||
done
|
||||
|
||||
[[ -L $config_dir/starship.toml ]] && restore_or_remove "$config_dir/starship.toml" "starship.toml"
|
||||
[[ -L $config_dir/fastfetch/config.jsonc ]] && restore_or_remove "$config_dir/fastfetch/config.jsonc" "fastfetch/config.jsonc"
|
||||
|
||||
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"
|
||||
|
||||
Reference in New Issue
Block a user