Commit Graph

382 Commits

Author SHA1 Message Date
Anton Volnuhin
e5207ac154 tide: derive the light segment background from the terminal's own
A fixed E4E4E4 segment was 1.04:1 against Kaolin Breeze's EBE8E4 -- an
invisible pill -- and a neutral grey reads as a foreign object on a warm
or cool background anyway. Read the background kitty is showing and place
the segment a fixed contrast step below it, so it keeps the theme's tint.
Default step is 1.12:1; __tide_terminal_segment_contrast overrides it.

Moving the segment invalidates the foregrounds, which are authored at
exactly 4.5:1 against E4E4E4 with no headroom, so re-aim them at the
derived segment by the single ratio the palette's shared luminance ceiling
moved by. That scaling runs in linear light, where luminance is a weighted
sum of the channels and so scales exactly; scaling the encoded channels
drifts further the darker a color gets, which is where the floor binds.

Also fix the baseline capture: the overrides are exported, so a Fish
started from a Fish that had already applied a palette was capturing that
palette as its dark baseline and could never restore dark. Drop inherited
globals first so the baseline comes from the universal scope Tide writes.

Dark mode is unchanged.
2026-08-06 15:34:51 +03:00
Anton Volnuhin
8c9e5e2c99 kitty: keep the tab bar on the terminal background
Catppuccin Latte sets tab_bar_background #BCC0CC, a grey noticeably
darker than its #EFF1F5 background, so in light mode the tab bar sat on
a band of its own colour. kitty.conf leaves the setting commented out --
kitty's default is to follow the terminal background -- but the
generated *-theme.auto.conf files are applied with priority over
kitty.conf, so the theme won and there was nowhere left to override it.

repair-auto-themes.sh already normalises macos_titlebar_color for the
same reason; give tab_bar_background the same treatment. The canonical
copies under theme-modes stay exactly as the themes kitten saved them.

Also picks up the current theme choices: SpaceGray Eighties for dark,
Catppuccin Latte for light.
2026-08-06 14:34:19 +03:00
Anton Volnuhin
ccf4a18c86 kitty: match any prefix of the themes kitten, not just "themes"
`kitten theme` runs the themes kitten -- kitty accepts unambiguous prefixes
-- but the shim tested `$argv[1] = themes` exactly, so that spelling skipped
the capture and re-apply entirely. Before the theme-mode work that was
harmless, since nothing rewrote the automatic theme files; now the next
regeneration reverts whatever was just chosen, which is why picking a theme
stopped sticking.

Accept any prefix of "themes" at least two characters long. Verified that
themes/theme/them/th all trigger and icat still does not.
2026-08-06 05:04:05 +03:00
Anton Volnuhin
9e2667f8fe kitty: capture theme choices however the kitten was launched
Saving a theme stopped sticking: the choice was captured only by the fish
`kitten` wrapper, so `kitty +kitten themes`, a keybinding or any non-fish
shell wrote <appearance>-theme.auto.conf directly and the next regeneration
overwrote it from theme-modes. The dark slot had already lost a pick that
way -- dark-theme.auto.conf held #0d0f31 while canonical dark said #2b2c2e.

Move the capture into apply-theme-mode.sh, which every path runs. It records
a cksum of each generated file after the repair step; on the next run a file
whose checksum differs was written by something else, so it becomes canonical
for that appearance. With no state recorded yet nothing is adopted, so a
first run cannot mistake a pinned mode's duplicated files for real choices.

The fish wrapper keeps only its useful part: re-apply the mode and reload so
the change shows at once.

theme-modes/dark.conf is the recovered #0d0f31 (1984). Covered by a new case
in tests/test_theme_mode.sh that writes the theme file with no shell involved.
2026-08-06 04:42:59 +03:00
Anton Volnuhin
489b401f2f kitty: Galaxy for dark, GrokDay for light
Captures the current theme choices in the canonical store: theme-modes/
dark.conf is Galaxy and light.conf is GrokDay, both verified identical
to their source theme files.
2026-08-06 03:42:48 +03:00
Anton Volnuhin
af05b9e245 ping: check IPv6 is actually usable, and split ping4 per platform
The ping wrapper only asked whether the *target* had an AAAA record, never
whether this machine could reach over IPv6, so `ping ya.ru` ran ping6 and
died with "No route to host" while IPv4 worked fine.

Checking for a default v6 route is not sufficient either: this Mac has one
while holding only ::1 and fe80:: link-locals. So require a global unicast
address (2000::/3) as well as the route, which is the condition that
actually fails here.

ping4 is now platform-split rather than branching internally, since macOS
ping rejects -4:
  macOS  ~/.local/bin/ping (wrapper) and ~/.local/bin/ping4 -> /sbin/ping
  Linux  a fish function running `ping -4`
.chezmoiignore gates each side so neither lands where it cannot work.
2026-08-06 03:38:12 +03:00
Anton Volnuhin
0f758cb668 kitty: use grok's bg_base for the grok theme backgrounds
Both themes used bg_terminal, on the assumption the name meant "the
terminal's background". It does not -- the shared Theme struct documents
it as "For terminal output blocks (currently unused, using bg_dark
instead)". The surface grok actually paints is bg_base, so GrokDay was
rendering brighter than grok itself (#f5f5f5 vs #eeeeee) and GrokNight
darker (#0a0a0a vs #141414).

GrokDay's color15 moves from bg_storm to bg (#f5f5f5): bg_storm is now
the background, so bright white would have been invisible against it.

Audited every slot in both files against the source palettes: each value
maps to a named palette color, no text color is under 3:1 on its
background, and cursor and selection overlays clear 4.5:1.
2026-08-06 03:29:30 +03:00
Anton Volnuhin
1c4e3774cf kitty: put the grok themes in the picker, move the mode store aside
`kitten themes` treats every .conf in <config-dir>/themes as a user
theme, which the mode system's canonical store was sitting in -- so the
picker was offering three bogus entries named light, dark and
no-preference, and had been since that store was introduced.

Move the store to ./theme-modes so ./themes means only what the kitten
means by it, and repoint apply-theme-mode.sh, the kitten shim, the
run_after hook and the test at the new path.

GrokNight and GrokDay move into ./themes with the ## name/author/
license/upstream/blurb header the kitten reads, so they now show up in
`kitten themes` and `--dump-theme` resolves them.

theme-modes/dark.conf carries the #202020 theme that was already on
disk: the file had to be re-added at its new path, so that drift comes
along with it.
2026-08-06 03:24:48 +03:00
Anton Volnuhin
c2d0485320 kitty: add GrokNight and GrokDay themes
Ported from grok build's TUI themes, whose palettes are defined in
crates/codegen/xai-grok-pager-render/src/theme/{groknight,grokday}.rs in
xai-org/grok-build -- they are compiled RGB constants, not extractable
from the shipped binary.

background uses grok's bg_terminal and cursor uses accent_user, which
grok sets over OSC 12 at startup, so a grok session sits flush against
the terminal. ANSI slots map onto the palette's own normal/bright pairs.

GrokNight's blue uses `blue` in both slots, as upstream TokyoNight does:
the palette's blue0 is a background blue and only reaches 2.96:1 on
#0a0a0a, which is too dim for ls output.
2026-08-06 03:04:36 +03:00
Anton Volnuhin
1485ab26d9 reasonix: drop the duplicated api key, keep config.json local
config.json carried a raw apiKey byte-identical to DEEPSEEK_API_KEY in
~/.reasonix/.env, which config.toml already names properly via
api_key_env -- so the copy was redundant, not load-bearing. Removed it;
`reasonix doctor --json` still reports key_present=true for both
providers and the rest of the report is unchanged.

The remainder of config.json is machine-local state -- a generated
dashboard token, its port, and UI flags -- so ignore it rather than
track it. config.toml stays tracked and holds the portable config.
2026-08-06 02:55:33 +03:00
Anton Volnuhin
2ba14d3e6d opencode: fix invalid config and externalize the bailian key
opencode rejected the config with "Unrecognized key: providers". The
file had both `provider` (opencode's schema: npm + options) and
`providers` (package: "aisdk:..." + settings, some other tool's shape,
left behind by an api-for-cursor script back in July). The Alibaba/Qwen
provider lived only under the rejected key, so it had never actually
reached opencode.

Translate it into the real schema -- package -> npm, settings -> options
at both provider and model level -- rather than dropping it, so those
five qwen models now work. The duplicate cursorapi under `providers` is
dropped: the existing provider.cursorapi is a superset, with four models
plus cost and limit metadata.

The 113-char bailian key moves to secrets/bailian-api-key (0600) and is
referenced as {file:./secrets/bailian-api-key}, which opencode resolves
relative to the config dir -- so no absolute home path, and no shell
export needed on ssh-only boxes. Verified by pointing it at a missing
file and getting "bad file reference".

With the key out, opencode.json can finally be tracked. Ignore the
secrets dir, the stale .bak copies that still contain it, and the
node/bun lockfiles.
2026-08-06 02:53:27 +03:00
Anton Volnuhin
a84778a640 fix(kitty): read file permissions correctly where stat is GNU
`chezmoi apply` on Linux printed "could not regenerate kitty theme
files" every run. GNU stat reads -f as --file-system, so
`stat -f '%Lp' file` prints a block of filesystem info to stdout and
exits non-zero. The `|| stat -c '%a'` fallback then appended the real
answer to that block, and chmod rejected the result, failing the script
under set -e.

Replace the chain with a file_mode() helper in both scripts: try the GNU
form first, since BSD rejects -c cleanly without printing anything, and
accept the answer only if it is octal. Covered by a new case in
tests/test_theme_mode.sh using a stat stub that reproduces GNU's
behaviour; it fails against the old chain.
2026-08-06 02:39:49 +03:00
Anton Volnuhin
5b58460618 Track agent CLI configs, with codex secrets externalized
codex's config.toml held nine live API keys inline under
[mcp_servers.*.env] -- deepseek, gemini, kimi, mimo, qwen, glm, cursor,
an OpenAI key and a Home Assistant token -- so it could not be tracked
as it stood. TOML env tables take literal values only, with no ${VAR}
indirection or env_file, so the keys cannot simply be named there.

Move them to ~/.codex/secrets.env (0600, ignored) and route the four
affected servers through mcp-with-secrets.sh, which sources that file
and execs the real command. Doing it in the wrapper rather than relying
on exported shell vars means it does not depend on how codex handles
environment inheritance, and works on ssh-only boxes with no keychain or
1Password agent, which is why this was preferred over a chezmoi
template.

Adds configs for claude, codex, pi, grok, kimi, kimi-code and reasonix,
and extends .chezmoiignore so credentials, session logs, local state and
.bak files stay out even if a directory is ever added whole.

Held back for still containing live keys: opencode.json (bailian), and
reasonix config.json and .env.
2026-08-06 02:23:49 +03:00
Anton Volnuhin
826a9417e7 kitty: make the theme mode per-machine
theme-mode is a per-machine preference, and the three *-theme.auto.conf
files are generated from it plus themes/, so tracking any of them made
every machine flag the others' choice. Drop all four from the source
state and ignore them.

That leaves a freshly applied machine with no theme files for kitty to
read, so add run_after_kitty-theme-mode.sh to regenerate them from the
canonical themes. It defaults to `auto`, so a new machine follows its OS
until told otherwise, and it exits quietly where this kitty config isn't
applied rather than failing the run.

Since that script now runs on every apply, including on Linux, make the
permission lookup in both shell scripts fall back from BSD `stat -f` to
GNU `stat -c` and then to 600.
2026-08-06 02:03:13 +03:00
Anton Volnuhin
74b7f27c06 pi: capture the cursorapi provider and reformat models.json
Local drift that was never added: a cursorapi provider pointing at
http://127.0.0.1:8788/v1, plus the formatting pi itself writes. No key
material -- the apiKey fields hold env var names or the local
placeholder.
2026-08-06 01:59:18 +03:00
Anton Volnuhin
f7baca7b3b kitty: pin the theme mode to dark
Captures the current mode. The two generated theme files now hold the
dark theme because the mode is pinned; themes/light.conf still has the
light theme, so `theme light` and `theme auto` restore it.
2026-08-06 01:59:12 +03:00
Anton Volnuhin
addce489b4 kitty: remember the light/dark mode across restarts
kitty gives *-theme.auto.conf priority over everything -- includes and
even --override -- and has no option to stop following the OS. So the
only way to start in a chosen mode is to control what those files
contain. Make them generated:

  themes/{light,dark,no-preference}.conf  canonical, the real themes
  theme-mode                              auto | light | dark
  apply-theme-mode.sh                      writes the three .auto.conf

Under `auto` each appearance keeps its own theme, so kitty follows the
OS as before. Pinned, all three get the pinned theme, so kitty starts in
it whatever the OS says and a config reload no longer resets it.

`theme` now records the mode and reloads instead of calling set-colors,
which is why the setting survives restarts. A bare `theme` records
`auto` rather than pinning when the toggle lands on the macOS
appearance, so nothing is pinned unless it actually differs.

The kitten shim hashes the automatic theme files before running `kitten
themes` and copies whichever changed into themes/, so picking a new
light theme while pinned to dark is kept and applied on the next switch.
Covered by tests/test_theme_mode.sh.

conf.d/kitty_theme.fish is gone: theme-mode is now the source of truth,
so the universal-variable tracker it maintained is redundant.
2026-08-06 01:49:45 +03:00
Anton Volnuhin
f66ee4d845 kitty: give active ssh tabs the same foreground as every other tab
__kitty_tab_set sent a luminance-picked black/white active_fg, so a
tinted tab's title looked different from a normal one. Send NONE
instead: tab_fg() then falls back to the shared active foreground (the
theme background) while active_bg keeps the per-host tint.

Covered by a new case in tests/test_tab_bar_colors.py matching what
__kitty_tab_set actually sends — host background, no fg override.
2026-08-06 01:35:25 +03:00
Anton Volnuhin
31d3048abe fix(kitty): restore per-host tab colors in the custom tab bar
a68b138 made draw_tab() derive all four color roles from tab_colors(),
so it stopped reading the per-tab colors that `kitten @ set-tab-color`
sets. The ssh wrapper (__kitty_tab_set) still set them, but the renderer
discarded them and every remote tab drew in the #2e84e6 accent.

Resolve the drawn colors through DrawData.tab_fg/tab_bg on the already
role-substituted title_draw_data: those return the per-tab override when
one is set and the accent roles otherwise. Theme-provided tab colors
still cannot leak in, so the theme-independence fix is preserved.

Extend tests/test_tab_bar_colors.py with the override case; it fails
against the old renderer (got the accent, wanted the host color).
2026-08-06 01:31:40 +03:00
Anton Volnuhin
739e906080 fish: only read the keychain PAT on systems that have security
The bare command substitution ran on every shell start regardless of
platform, so Linux/WSL printed "fish: Unknown command: security" at
login — the 2>/dev/null only redirects the command's own stderr, not
fish's command-not-found diagnostic.

Guard with `type -q security`, matching conf.d/codex-github-mcp.fish,
and skip the export when the lookup returns nothing so a missing
keychain item no longer exports an empty GITHUB_PERSONAL_ACCESS_TOKEN.
2026-08-06 01:23:07 +03:00
Anton Volnuhin
384bfe57b3 fish: add theme command to toggle kitty light/dark
`theme` switches kitty between the existing dark-theme.auto.conf and
light-theme.auto.conf via `kitty @ set-colors --all --configured`, so it
stays in sync with whatever `kitten themes --light/--dark` selects.
Subcommands: light, dark, auto (hand control back to the OS appearance
via load-config), status.

Tide is resynced by calling __tide_apply_terminal_appearance directly,
so the prompt recolors even if kitty sends no palette-change
notification for a dynamic color change. conf.d/kitty_theme.fish tracks
$fish_terminal_color_theme into $kitty_theme_mode so the toggle still
reads the real state after kitty follows an OS appearance change.

light-theme.auto.conf had no tab colors, which left the dark tab bar on
a light background after switching; add a matching tab style block.
2026-08-06 01:15:47 +03:00
Anton Volnuhin
0defab964d tab strategy + font size 15 2026-07-28 17:17:48 +03:00
Anton Volnuhin
9c339fb730 theme small changes and fixes 2026-07-28 04:57:07 +03:00
Anton Volnuhin
a68b138d38 fix(kitty): preserve tab styling across themes 2026-07-28 04:53:48 +03:00
Anton Volnuhin
a4eb8ae75d Sync Kitty automatic themes from maxwell 2026-07-27 22:44:57 +03:00
Anton Volnuhin
92d4bbd7d5 Preserve local Karabiner and Pi preferences 2026-07-27 22:33:34 +03:00
Anton Volnuhin
296bd3af80 Small combined changes 2026-07-27 20:23:32 +03:00
Anton Volnuhin
73176c2bfb fish, kitty: follow terminal light theme 2026-07-27 20:20:38 +03:00
Anton Volnuhin
781c86d80a Add pi agent config (models, settings)
Manage ~/.pi/agent/models.json and settings.json via chezmoi.
Exclude auth.json (real secrets) and sessions/ (ephemeral logs).
2026-06-21 18:49:33 +03:00
Anton Volnuhin
6c7e0eabfc terminfo: cursor reset restores terminal default (beam), not block 2026-06-12 01:28:40 +03:00
Anton Volnuhin
e3c9f4edd5 fish: smarter SSH_AUTH_SOCK refresh, reading tmux session env over stale global 2026-06-12 01:25:16 +03:00
Anton Volnuhin
497cbce0c6 kitty: add ctrl+shift detach_window keybindings 2026-06-12 01:25:16 +03:00
Anton Volnuhin
c6159eb278 tmux: use session name as kitty tab title, with @host over SSH 2026-06-12 01:12:04 +03:00
Anton Volnuhin
a967a4981e tmux: show session name in status bar
Add a nova 'session' segment (#S) on the right side, styled with the
same colors as the window tabs (#6272a4 bg / #f8f8f2 fg).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-30 02:13:55 +03:00
Anton Volnuhin
fdc149e9ec small updates to tabs, agy 2026-05-22 03:11:32 +03:00
Anton Volnuhin
771d30c136 Add tmux option tab bindings 2026-05-22 02:00:21 +03:00
Anton Volnuhin
b12882aa80 Make tmux tabs theme-aware 2026-05-22 01:57:56 +03:00
Anton Volnuhin
ca06e649c9 Update tmux tab labels 2026-05-22 01:27:11 +03:00
Anton Volnuhin
edc02d1bb5 Use Ctrl-Shift brackets for tmux windows 2026-05-20 02:46:44 +03:00
Anton Volnuhin
b59b0335c8 Add tmux CSI-u bracket bindings 2026-05-20 02:42:42 +03:00
Anton Volnuhin
1590a272aa kitty: color terminal tabs by ssh/mosh host
Tint the kitty tab background by target host so local vs remote (and
which remote) is visible at a glance.

- __kitty_host_color: explicit color table for known hosts (routers,
  resolvers, ryzen/mini, personal cloud, geo VPS) + stable hashed
  palette fallback; auto-picks readable fg by luminance
- __kitty_ssh_host: parse target host from ssh/mosh-style argv
- __kitty_tab_set/__kitty_tab_reset: active tab = full host-color bg,
  inactive tab = dark theme bg with host-color text; revert on exit
- ssh wrapper + s (kitten ssh) and m (mosh) wired to tint/reset

Also includes unrelated pending dotfile changes (GH MCP PAT from
keychain in fish/zsh, kitty/wezterm font_size 15->14, kitty
colorspace displayp3) committed together at user request.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-19 23:08:32 +03:00
Anton Volnuhin
fe835de7f1 double kitty integration fix -> no more brick cursor bug after switching to kitty and back 2026-04-10 15:11:30 +03:00
Anton Volnuhin
de32b5f5d6 m for mosh and s for ssh, both with second arg for tmux session 2026-04-09 02:24:45 +03:00
Anton Volnuhin
87bcad6c6d clipboard fixes for tmux and nvim 2026-04-09 02:21:29 +03:00
Anton Volnuhin
10c759e3a9 kitty fish to chezmoi 2026-04-07 23:56:28 +03:00
Anton Volnuhin
83e26550d0 wrong cursor stuff fix 2026-04-07 23:52:35 +03:00
Anton Volnuhin
5274042036 experimental fish cursor fixes 2026-04-07 23:39:17 +03:00
Anton Volnuhin
b0dbb8e0b2 working shift+enter everywhere 2026-04-07 23:34:01 +03:00
Anton Volnuhin
4bab71f9ab dark kitten icon for kitty 2026-04-06 14:46:04 +03:00
Anton Volnuhin
bfafb03296 switch tide to plttn/tide@v7, as my fix was merged in there 2026-04-05 19:42:28 +03:00