Keep the personal half of the desktop in one place, and ask before installing it

Agent instructions, skills, SSH host aliases and expansion triggers are worth
having identical on every machine one person owns, and belong in none of the
shared configuration. They live in user/ now, with a manifest saying where each
piece goes and a link-user stage that puts it there.

That stage does nothing unless the machine said yes. Somebody who clones Panama
to try the desktop keeps their own ~/.claude/CLAUDE.md exactly where it was;
the question names the destinations and defaults to no. Anything displaced goes
to config/old rather than being deleted.

~/.claude/CLAUDE.md and ~/.codex/AGENTS.md were byte-identical copies of one
file, which is the drift this exists to prevent.

Also adds the vitals toggles for the battery and Claude usage readouts, which
had preferences and no way to reach them.
This commit is contained in:
Gabriel Brown
2026-08-22 08:54:43 -04:00
parent 8b96d907a1
commit 89761a7da3
156 changed files with 16439 additions and 6 deletions
@@ -0,0 +1,155 @@
---
name: global-context
description: Access navigation, slide info, and configuration programmatically
---
# Global Context & API
Access navigation, slide info, and configuration programmatically.
## Template Variables
Available in slides and components:
```md
Page {{ $page }} of {{ $nav.total }}
Title: {{ $slidev.configs.title }}
```
### $nav
Navigation state and controls:
| Property | Type | Description |
|----------|------|-------------|
| `$nav.currentPage` | number | Current page (1-indexed) |
| `$nav.currentLayout` | string | Current layout name |
| `$nav.total` | number | Total slides |
| `$nav.isPresenter` | boolean | In presenter mode |
| `$nav.next()` | function | Next click/slide |
| `$nav.prev()` | function | Previous click/slide |
| `$nav.nextSlide()` | function | Next slide |
| `$nav.prevSlide()` | function | Previous slide |
| `$nav.go(n)` | function | Go to slide n |
### $slidev
Global context:
| Property | Description |
|----------|-------------|
| `$slidev.configs` | Project config (title, etc.) |
| `$slidev.themeConfigs` | Theme config |
### $frontmatter
Current slide frontmatter:
```md
Layout: {{ $frontmatter.layout }}
```
### $clicks
Current click count on slide.
### $page
Current page number (1-indexed).
### $renderContext
Current render context:
- `'slide'` - Normal slide view
- `'overview'` - Overview mode
- `'presenter'` - Presenter mode
- `'previewNext'` - Next slide preview
## Composables
Import from `@slidev/client`:
```ts
import {
useNav,
useDarkMode,
useIsSlideActive,
useSlideContext,
onSlideEnter,
onSlideLeave,
} from '@slidev/client'
```
### useNav
```ts
const nav = useNav()
nav.next()
nav.go(5)
console.log(nav.currentPage)
```
### useDarkMode
```ts
const { isDark, toggle } = useDarkMode()
```
### useIsSlideActive
```ts
const isActive = useIsSlideActive()
// Returns ref<boolean>
```
### useSlideContext
```ts
const { $page, $clicks, $frontmatter } = useSlideContext()
```
## Lifecycle Hooks
```ts
import { onSlideEnter, onSlideLeave } from '@slidev/client'
onSlideEnter((to, from) => {
// Slide became active
startAnimation()
})
onSlideLeave((to, from) => {
// Slide became inactive
cleanup()
})
```
**Important:** Don't use `onMounted`/`onUnmounted` in slides - component instance persists. Use `onSlideEnter`/`onSlideLeave` instead.
## Conditional Rendering Examples
```html
<!-- Show only in presenter mode -->
<div v-if="$nav.isPresenter">
Presenter notes
</div>
<!-- Hide on cover slide -->
<footer v-if="$nav.currentLayout !== 'cover'">
Page {{ $nav.currentPage }}
</footer>
<!-- Different content by context -->
<template v-if="$renderContext === 'slide'">
Normal view
</template>
<template v-else-if="$renderContext === 'presenter'">
Presenter view
</template>
```
## Type Imports
```ts
import type { TocItem } from '@slidev/types'
```