diff --git a/README.md b/README.md index d3ae581..09d6560 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ It runs these steps, in this order, and every one of them is idempotent: | 2. `BLOB_PATH` | symlinks `~/.local/share/blob` to this checkout | | 3. Packages | installs what is missing from `packages/`, bootstrapping `yay` first on a machine that has no AUR helper | | 4. Config | copies `hypr/`, the themed app configs, `blob/shell.json`, the uwsm environment, and the icon font into `~/.config` | -| 5. First theme | links `~/wallpapers` to the checkout, applies `flats` headless, and picks a background, so the first login is not a blank desktop | +| 5. First theme | links `~/wallpapers` to the checkout, applies `flats` headless, picks a background, and links the btop and Neovim theme files, so the first login is not a blank desktop | | 6. User units | installs the session services into `~/.config/systemd/user` and enables them | | 7. systemd drop-ins | writes the shutdown timeouts, oomd thresholds, plocate prune paths, and sleep hooks under `/etc` | | 8. System services | enables NetworkManager, resolved, bluetooth, cups, avahi, docker, power-profiles-daemon, and oomd, and masks `NetworkManager-wait-online` | diff --git a/config/kitty/current-theme.conf b/config/kitty/current-theme.conf deleted file mode 100644 index 0c97e1a..0000000 --- a/config/kitty/current-theme.conf +++ /dev/null @@ -1,83 +0,0 @@ -# vim:ft=kitty - -## name: Flats -## upstream: themes/flats/colors.toml -## blurb: Dark theme with a soft blue accent. Hand-translated from the -## Omarchy colors.toml, since macOS has no omarchy-theme-set. - - -# The basic colors -foreground #cbd2d9 -background #0f1012 -selection_foreground #0f1012 -selection_background #7babe3 - -# Cursor colors -cursor #cbd2d9 -cursor_text_color #0f1012 - -# URL underline color when hovering with mouse -url_color #7babe3 - -# Kitty window border colors -active_border_color #7babe3 -inactive_border_color #949494 -bell_border_color #d58638 - -# OS Window titlebar colors -wayland_titlebar_color system -macos_titlebar_color system - -# Tab bar colors -active_tab_foreground #0f1012 -active_tab_background #7babe3 -inactive_tab_foreground #cbd2d9 -inactive_tab_background #0f1012 -tab_bar_background #000000 - -# Colors for marks (marked text in the terminal) -mark1_foreground #0f1012 -mark1_background #7babe3 -mark2_foreground #0f1012 -mark2_background #38d586 -mark3_foreground #0f1012 -mark3_background #d58638 - -# The 16 terminal colors -# -# Note: flats maps the ANSI slots unconventionally — color4 (blue) holds a -# magenta and color6 (cyan) holds the blue, among others. Kept faithful to -# colors.toml so both machines render identically; the comments below name -# the ANSI slot, not the resulting hue. - -# black -color0 #000000 -color8 #949494 - -# red -color1 #d53838 -color9 #d53838 - -# green -color2 #38d4d5 -color10 #38d4d5 - -# yellow -color3 #d58638 -color11 #d58638 - -# blue -color4 #d53886 -color12 #d53886 - -# magenta -color5 #38d586 -color13 #38d586 - -# cyan -color6 #3886d5 -color14 #3886d5 - -# white -color7 #d4d4d4 -color15 #d4d4d4 diff --git a/config/kitty/kitty.conf b/config/kitty/kitty.conf index 2de2a07..7cf92dd 100644 --- a/config/kitty/kitty.conf +++ b/config/kitty/kitty.conf @@ -1,11 +1,10 @@ # vim:ft=kitty # -# kitty config for macOS. The Arch side of these dotfiles gets its terminal -# colors from omarchy-theme-set rewriting the active theme; there is no -# omarchy here, so current-theme.conf is checked in alongside this file and -# generated by hand from themes//colors.toml. +# Colors come from the active theme, the same way foot.ini takes them: the +# theme pipeline renders default/themed/kitty.conf.tpl into the current-theme +# directory, and blob-restart-terminal signals kitty to reload it. -include current-theme.conf +include ~/.local/state/blob/current/theme/kitty.conf # Fonts diff --git a/docs/install.md b/docs/install.md index a23c455..2986ab6 100644 --- a/docs/install.md +++ b/docs/install.md @@ -37,8 +37,12 @@ with `--check`. `wallpapers/`, `flats` is applied with `BLOB_THEME_HEADLESS=1` (no shell or session bus exists yet), and the background symlink is pointed at the first image in `~/wallpapers`. Without this the first login has no palette and no - wallpaper, which draws as a black desktop. All three steps are skipped when a - theme, a background or a wallpaper directory of your own is already there. + wallpaper, which draws as a black desktop. It then links the per-app theme + files the pipeline renders but no app would otherwise find: + `~/.config/btop/themes/current.theme` (btop's `color_theme = "current"`) and, + only when `~/.config/nvim/lua/plugins` already exists, `theme.lua` there. + Every step is skipped when a theme, a background, a wallpaper directory or a + theme file of your own is already in place. 6. **User units** land in `~/.config/systemd/user` and are enabled, not started: they are all `WantedBy=graphical-session.target`, so they come up with the session. `blob-speaker-tuning.service` is left out, because diff --git a/docs/themes.md b/docs/themes.md index 1f5d1f3..1d91379 100644 --- a/docs/themes.md +++ b/docs/themes.md @@ -27,6 +27,12 @@ the shell and the CLI never disagree about what a slot means. ## Templates +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` and `neovim.lua` through symlinks the installer +makes into those apps' own config trees. + `default/themed/*.tpl` are rendered per theme into `~/.local/state/blob/current/theme/`. Nine ship: foot, kitty, btop, chromium, hyprland, the screenshare picker, neovim, `shell.toml`, and zen. diff --git a/install.sh b/install.sh index 5f3c152..4ecc985 100755 --- a/install.sh +++ b/install.sh @@ -70,6 +70,7 @@ install_zen_config link_wallpapers install_default_theme install_default_background +link_app_themes enable_system_services mask_system_services diff --git a/install/steps/theme.sh b/install/steps/theme.sh index e15d3c4..24c2f8d 100644 --- a/install/steps/theme.sh +++ b/install/steps/theme.sh @@ -90,3 +90,47 @@ install_default_background() { ln -nsf "$first" "$link" say "bg $(basename "$first")" } + +# The theme pipeline renders one file per app into the current-theme directory, +# but each app only ever reads its own config tree. These links are what join +# the two. Without them a theme switch silently leaves the app on stock colors, +# because nothing errors: the app just never sees the generated file. +link_theme_file() { + local theme_file="$1" dest="$2" label="$3" + local target="$current_state_dir/theme/$theme_file" + + if [[ -L $dest ]] && [[ "$(readlink "$dest")" == "$target" ]]; then + say "ok $label" + return 0 + fi + + if [[ -e $dest && ! -L $dest ]] && [[ $force == false ]]; then + note_change + say "DIFF $label (own file kept; --force to replace)" + return 0 + fi + + note_change + if [[ $check == true ]]; then + say "would link $label" + return 0 + fi + + mkdir -p "$(dirname "$dest")" + ln -nsf "$target" "$dest" + say "link $label" +} + +# btop reads color_theme = "current" out of its own themes directory, and +# Neovim loads whatever theme.lua its plugin directory holds. Neovim is only +# linked when that directory already exists: Blob ships no Neovim config, so +# creating the tree would be inventing a layout the user has not chosen. +link_app_themes() { + link_theme_file btop.theme "$config_dir/btop/themes/current.theme" "btop theme" + + if [[ -d $config_dir/nvim/lua/plugins ]]; then + link_theme_file neovim.lua "$config_dir/nvim/lua/plugins/theme.lua" "neovim theme" + else + say "SKIP neovim theme (no ~/.config/nvim/lua/plugins)" + fi +}