mux-sesh 1.7.1 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -329
- package/package.json +1 -1
- package/src/app/commands.ts +10 -0
- package/src/app/controller.ts +2 -0
- package/src/app/data.ts +5 -1
- package/src/app/handlers.ts +48 -0
- package/src/app/keyboard.ts +2 -0
- package/src/config/index.ts +24 -0
- package/src/handlers/keyboard/normal.ts +9 -0
- package/src/handlers/keyboard/shared.ts +1 -0
- package/src/items/order.ts +41 -8
- package/src/search/index.ts +4 -0
- package/src/settings.ts +13 -0
- package/src/types/index.ts +2 -0
- package/src/ui/CommandsModal.tsx +11 -0
- package/src/ui/Toast.tsx +11 -8
- package/src/ui/item-icon.ts +5 -2
package/README.md
CHANGED
|
@@ -1,390 +1,128 @@
|
|
|
1
1
|
# mux-sesh
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Fast tmux session switching and project launching from a polished terminal UI.
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<img src="screenshot.png" alt="mux-sesh screenshot" width="800">
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Why mux-sesh
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
- **Project scanning** - Browse and create sessions from local directories
|
|
16
|
-
- **Config-driven sessions** - Exact project rules, wildcard rules, and listed config targets
|
|
17
|
-
- **Session-aware project picker** - See when a project will attach to an existing tmux session vs create a new one
|
|
18
|
-
- **Rich previews** - Preview commands with directory fallback and live tmux context for running projects
|
|
19
|
-
- **GitHub integration** - Clone repos directly from URLs
|
|
20
|
-
- **Quick select** - Use number keys (1-9) for instant switching
|
|
21
|
-
- **Session management** - Create, switch, kill, and rename sessions
|
|
11
|
+
- Switch to live tmux sessions without leaving the keyboard.
|
|
12
|
+
- Launch local projects from a single, searchable picker.
|
|
13
|
+
- Keep reusable project rules in config instead of shell scripts.
|
|
14
|
+
- Stay inside tmux with previews, quick actions, and lightweight workflows.
|
|
22
15
|
|
|
23
|
-
##
|
|
16
|
+
## Quick Start
|
|
24
17
|
|
|
25
|
-
|
|
18
|
+
`mux-sesh` runs on Bun and talks directly to tmux.
|
|
26
19
|
|
|
27
|
-
|
|
28
|
-
- [Zig](https://ziglang.org) - Required for building OpenTUI
|
|
29
|
-
- tmux - Terminal multiplexer
|
|
30
|
-
- git - For GitHub cloning feature
|
|
20
|
+
Prerequisites:
|
|
31
21
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
- [Bun](https://bun.sh)
|
|
23
|
+
- [tmux](https://github.com/tmux/tmux/wiki)
|
|
24
|
+
- [git](https://git-scm.com) for cloning GitHub repositories from the new-session flow
|
|
35
25
|
|
|
36
|
-
|
|
37
|
-
brew install zig
|
|
26
|
+
Install globally:
|
|
38
27
|
|
|
39
|
-
|
|
28
|
+
```bash
|
|
29
|
+
bun install -g mux-sesh
|
|
40
30
|
```
|
|
41
31
|
|
|
42
|
-
|
|
32
|
+
Run it:
|
|
43
33
|
|
|
44
34
|
```bash
|
|
45
|
-
bun install -g mux-sesh
|
|
46
|
-
|
|
47
|
-
# Then run
|
|
48
35
|
mux-sesh
|
|
49
36
|
```
|
|
50
37
|
|
|
51
|
-
|
|
38
|
+
Recommended tmux binding:
|
|
39
|
+
|
|
40
|
+
```tmux
|
|
41
|
+
bind-key -n M-w popup -E -w 62% -h 70% "mux-sesh"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Reload tmux after adding the binding:
|
|
52
45
|
|
|
53
46
|
```bash
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
tmux source-file ~/.tmux.conf
|
|
48
|
+
```
|
|
56
49
|
|
|
57
|
-
|
|
58
|
-
bun install
|
|
50
|
+
## How It Works
|
|
59
51
|
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
- Sessions view shows live tmux sessions.
|
|
53
|
+
- Projects view shows scanned or configured directories.
|
|
54
|
+
- Selecting a project attaches to an existing session when possible, or creates one.
|
|
55
|
+
- The new-session flow can also clone a GitHub repository into your configured repos directory.
|
|
62
56
|
|
|
63
|
-
|
|
64
|
-
sudo cp dist/mux-sesh /usr/local/bin/
|
|
65
|
-
# or
|
|
66
|
-
cp dist/mux-sesh ~/.local/bin/
|
|
67
|
-
```
|
|
57
|
+
## Minimal Configuration
|
|
68
58
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
### Normal Mode
|
|
72
|
-
|
|
73
|
-
| Key | Action |
|
|
74
|
-
| ---------------------- | ----------------------------------------------- |
|
|
75
|
-
| `j` / `k` or `↑` / `↓` | Navigate up/down |
|
|
76
|
-
| `1-9` | Quick select session/project |
|
|
77
|
-
| `Enter` | Switch to session / Create from project |
|
|
78
|
-
| `i` | Enter search mode |
|
|
79
|
-
| `n` | Create new session |
|
|
80
|
-
| `d` | Kill selected session |
|
|
81
|
-
| `r` | Rename selected session |
|
|
82
|
-
| `l` | Jump to previous tmux session |
|
|
83
|
-
| `g` | Open the git-root session for the selected item |
|
|
84
|
-
| `e` | Edit configured session target |
|
|
85
|
-
| `R` | Refresh list |
|
|
86
|
-
| `s` | Switch to sessions view |
|
|
87
|
-
| `p` | Switch to projects view |
|
|
88
|
-
| `q` or `Esc` | Quit |
|
|
89
|
-
|
|
90
|
-
### Standard Mode
|
|
91
|
-
|
|
92
|
-
Standard mode is a search-first workflow. mux-sesh starts in search mode, keeps the query box focused, and favors a configurable prefix key for secondary actions.
|
|
93
|
-
|
|
94
|
-
| Key | Action |
|
|
95
|
-
| --------- | -------------------- |
|
|
96
|
-
| Type | Filter immediately |
|
|
97
|
-
| `↑` / `↓` | Navigate results |
|
|
98
|
-
| `Enter` | Select first result |
|
|
99
|
-
| `Esc` | Clear current search |
|
|
100
|
-
| `Ctrl+P` | Open command palette |
|
|
101
|
-
| `Ctrl+Q` | Quit |
|
|
102
|
-
|
|
103
|
-
Default prefix: `Ctrl+X`.
|
|
104
|
-
|
|
105
|
-
Common prefix actions while in standard mode:
|
|
106
|
-
|
|
107
|
-
| Prefix action | Result |
|
|
108
|
-
| ------------- | ----------------------------- |
|
|
109
|
-
| `n` | New session |
|
|
110
|
-
| `o` | Open OpenCode session manager |
|
|
111
|
-
| `s` | Open settings |
|
|
112
|
-
| `l` | Jump to previous tmux session |
|
|
113
|
-
| `g` | Open git-root session |
|
|
114
|
-
| `r` | Rename selected live session |
|
|
115
|
-
| `d` | Kill selected live session |
|
|
116
|
-
| `Shift+R` | Refresh sessions/projects |
|
|
117
|
-
|
|
118
|
-
### Search Mode
|
|
119
|
-
|
|
120
|
-
| Key | Action |
|
|
121
|
-
| -------------- | ------------------------ |
|
|
122
|
-
| Type to search | Filter sessions/projects |
|
|
123
|
-
| `Enter` | Select first result |
|
|
124
|
-
| `↑` / `↓` | Navigate results |
|
|
125
|
-
| `Esc` | Cancel search |
|
|
126
|
-
|
|
127
|
-
### New Session Mode
|
|
128
|
-
|
|
129
|
-
| Key | Action |
|
|
130
|
-
| ----------------- | ------------------------ |
|
|
131
|
-
| Type project name | Filter projects |
|
|
132
|
-
| Paste GitHub URL | Clone and create session |
|
|
133
|
-
| Type custom name | Create named session |
|
|
134
|
-
| `Enter` | Confirm selection |
|
|
135
|
-
| `Esc` | Cancel |
|
|
136
|
-
|
|
137
|
-
## Configuration
|
|
138
|
-
|
|
139
|
-
Configuration is stored at `~/.config/mux-sesh/config.json`:
|
|
59
|
+
Config lives at `~/.config/mux-sesh/config.json`.
|
|
140
60
|
|
|
141
61
|
```json
|
|
142
62
|
{
|
|
143
|
-
"project_paths": ["~/dev", "~/personal"
|
|
63
|
+
"project_paths": ["~/dev", "~/personal"],
|
|
144
64
|
"repos_path": "~/dev/repos",
|
|
145
|
-
"editor": "nvim",
|
|
146
|
-
"editor_cmd": "nvim -c \"lua vim.defer_fn(function() if pcall(require, 'telescope') then vim.cmd('Telescope find_files') end end, 100)\"",
|
|
147
65
|
"keybind_mode": "vim",
|
|
148
66
|
"prefix_key": "ctrl+x",
|
|
149
67
|
"theme": "rosepine",
|
|
150
|
-
"color_scheme": "system",
|
|
151
|
-
"sort_order": "zoxide-first",
|
|
152
|
-
"zoxide_mode": "rank",
|
|
153
|
-
"auto_update": true,
|
|
154
|
-
"dir_length": 2,
|
|
155
|
-
"hidden_sessions": ["scratch", "tmp*"],
|
|
156
|
-
"icons": {
|
|
157
|
-
"tmux": "",
|
|
158
|
-
"configured": "",
|
|
159
|
-
"project": "",
|
|
160
|
-
"opencode": ""
|
|
161
|
-
},
|
|
162
|
-
"default_session": {
|
|
163
|
-
"startup_command": "nvim",
|
|
164
|
-
"preview_command": "eza --all {}"
|
|
165
|
-
},
|
|
166
|
-
"projects": [
|
|
167
|
-
{
|
|
168
|
-
"path": "~/.dotfiles/hypr/.config/hypr",
|
|
169
|
-
"session_name": "hyprland",
|
|
170
|
-
"listed": true,
|
|
171
|
-
"icon": "",
|
|
172
|
-
"startup_command": "nvim"
|
|
173
|
-
}
|
|
174
|
-
],
|
|
175
|
-
"wildcards": [
|
|
176
|
-
{
|
|
177
|
-
"pattern": "~/work/**",
|
|
178
|
-
"startup_command": "bun run dev"
|
|
179
|
-
}
|
|
180
|
-
]
|
|
181
|
-
}
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
### Configuration Options
|
|
185
|
-
|
|
186
|
-
- **`project_paths`** - Array of directories to scan for projects
|
|
187
|
-
- **`repos_path`** - Directory where GitHub repositories will be cloned
|
|
188
|
-
- **`editor`** - Default editor to use
|
|
189
|
-
- **`editor_cmd`** - Default startup command for new sessions unless overridden
|
|
190
|
-
- **`keybind_mode`** - `vim` or `standard`
|
|
191
|
-
- **`prefix_key`** - Prefix used for multi-key commands in standard mode and optional vim mode workflows
|
|
192
|
-
- **`theme`** - Built-in or custom theme name
|
|
193
|
-
- **`color_scheme`** - `system`, `dark`, or `light`
|
|
194
|
-
- **`sort_order`** - Session/project ordering: `live-first`, `configured-first`, `zoxide-first`, or `alphabetical`
|
|
195
|
-
- **`zoxide_mode`** - `off`, `rank`, or `merge` for zoxide-aware project ordering
|
|
196
|
-
- **`auto_update`** - Enable or disable background update checks
|
|
197
|
-
- **`dir_length`** - Number of path segments used when generating session names from git roots or project paths
|
|
198
|
-
- **`hidden_sessions`** - Glob patterns for live tmux sessions to hide from the list
|
|
199
|
-
- **`icons`** - Global icons for tmux, configured, project, and opencode rows
|
|
200
|
-
- **`themes`** - Optional custom theme definitions keyed by name
|
|
201
|
-
- **`default_session`** - Fallback startup and preview commands
|
|
202
|
-
- **`projects`** - Exact path rules with optional `session_name`, `startup_command`, `preview_command`, `listed`, and `icon`
|
|
203
|
-
- **`wildcards`** - Pattern-based defaults for matching projects
|
|
204
|
-
|
|
205
|
-
### Rule Resolution
|
|
206
|
-
|
|
207
|
-
When you select a project, mux-sesh resolves its behavior in this order:
|
|
208
|
-
|
|
209
|
-
1. Exact `projects[]` path match
|
|
210
|
-
2. First matching `wildcards[]` rule
|
|
211
|
-
3. `default_session`
|
|
212
|
-
|
|
213
|
-
Session names use the git root when available, then apply `dir_length` if you did not set an explicit `session_name`.
|
|
214
|
-
|
|
215
|
-
### Listed Sessions
|
|
216
|
-
|
|
217
|
-
Set `listed: true` on a project rule to keep that target visible in the Sessions view even when tmux has not started it yet. This works well for dotfiles, config folders, dashboards, and other “always useful” targets.
|
|
218
|
-
|
|
219
|
-
If a live tmux session already exists with the same title, the live session takes precedence.
|
|
220
|
-
|
|
221
|
-
### Sorting and Zoxide
|
|
222
|
-
|
|
223
|
-
- `zoxide_mode: off` - scan only
|
|
224
|
-
- `zoxide_mode: rank` - reorder discovered projects by zoxide score
|
|
225
|
-
- `zoxide_mode: merge` - include additional zoxide-ranked projects inside configured roots
|
|
226
|
-
- `sort_order: live-first` - live sessions before configured placeholders
|
|
227
|
-
- `sort_order: configured-first` - configured placeholders before live sessions
|
|
228
|
-
- `sort_order: zoxide-first` - preserve project discovery/zoxide ordering
|
|
229
|
-
- `sort_order: alphabetical` - alphabetical project and session ordering
|
|
230
|
-
|
|
231
|
-
### Preview Behavior
|
|
232
|
-
|
|
233
|
-
`preview_command` inherits from `default_session`, can be overridden per project rule, and supports `{}` interpolation for the selected path.
|
|
234
|
-
|
|
235
|
-
- if the preview command succeeds, mux-sesh renders its output in the detail panel
|
|
236
|
-
- if it fails or times out, mux-sesh falls back to a directory listing
|
|
237
|
-
- if a project already has a linked tmux session, the preview also includes live tmux window details
|
|
238
|
-
|
|
239
|
-
Example:
|
|
240
|
-
|
|
241
|
-
```json
|
|
242
|
-
{
|
|
243
68
|
"default_session": {
|
|
244
|
-
"
|
|
245
|
-
}
|
|
246
|
-
"projects": [
|
|
247
|
-
{
|
|
248
|
-
"path": "~/dev/projects/mux-sesh",
|
|
249
|
-
"preview_command": "git -C {} status --short"
|
|
250
|
-
}
|
|
251
|
-
]
|
|
69
|
+
"startup_command": "nvim"
|
|
70
|
+
}
|
|
252
71
|
}
|
|
253
72
|
```
|
|
254
73
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
For the best experience, bind mux-sesh to a global tmux keybinding. Add this to your `~/.tmux.conf`:
|
|
258
|
-
|
|
259
|
-
```bash
|
|
260
|
-
# Open mux-sesh in a popup with Alt+w (no prefix required)
|
|
261
|
-
bind-key -n M-w popup -E -w 62% -h 70% "mux-sesh"
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
After adding the binding, reload your tmux config:
|
|
265
|
-
|
|
266
|
-
```bash
|
|
267
|
-
tmux source-file ~/.tmux.conf
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
Now you can press `Alt+w` from anywhere in tmux (including inside nvim) to launch mux-sesh.
|
|
271
|
-
|
|
272
|
-
**Alternative Integration:**
|
|
273
|
-
|
|
274
|
-
- **From Neovim**: Use [mux-manager](https://github.com/quiet-ghost/mux-manager) - a Telescope-based tmux session manager that integrates directly into Neovim
|
|
275
|
-
- **With prefix**: Use `bind-key f popup -E -w 80% -h 80% "mux-sesh"` if you prefer requiring the tmux prefix key first
|
|
276
|
-
|
|
277
|
-
## Usage Examples
|
|
278
|
-
|
|
279
|
-
### Quick Session Switching
|
|
280
|
-
|
|
281
|
-
```bash
|
|
282
|
-
# Open mux-sesh
|
|
283
|
-
mux-sesh
|
|
284
|
-
|
|
285
|
-
# Press 1-9 to instantly switch to that session
|
|
286
|
-
# Or use j/k to navigate and Enter to select
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
### Create Session from Project
|
|
290
|
-
|
|
291
|
-
```bash
|
|
292
|
-
mux-sesh
|
|
293
|
-
|
|
294
|
-
# Press 'n' for new session
|
|
295
|
-
# Type project name to filter
|
|
296
|
-
# Rows show whether they will attach to an existing tmux session or create a new one
|
|
297
|
-
# Press Enter to create or attach
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
### Jump to Root / Last / Edit Target
|
|
301
|
-
|
|
302
|
-
```bash
|
|
303
|
-
mux-sesh
|
|
304
|
-
|
|
305
|
-
# Select a project or session, then press 'g' to jump to its git-root session
|
|
306
|
-
# Press 'l' to jump to the most recent non-current tmux session
|
|
307
|
-
# Select a configured session and press 'e' to open its target in your editor
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
### Clone from GitHub
|
|
74
|
+
Full configuration reference: [docs/configuration.md](docs/configuration.md)
|
|
311
75
|
|
|
312
|
-
|
|
313
|
-
mux-sesh
|
|
76
|
+
## Essential Keys
|
|
314
77
|
|
|
315
|
-
|
|
316
|
-
# Paste GitHub URL:
|
|
317
|
-
# https://github.com/user/repo
|
|
318
|
-
# or
|
|
319
|
-
# git@github.com:user/repo.git
|
|
320
|
-
# Press Enter to clone and create session
|
|
321
|
-
```
|
|
78
|
+
Default mode is `vim`.
|
|
322
79
|
|
|
323
|
-
|
|
80
|
+
| Key | Action |
|
|
81
|
+
| ----------- | --------------------- |
|
|
82
|
+
| `j` / `k` | Move |
|
|
83
|
+
| `Enter` | Attach or create |
|
|
84
|
+
| `i` | Search |
|
|
85
|
+
| `n` | New session |
|
|
86
|
+
| `d` | Kill selected session |
|
|
87
|
+
| `1-9` | Quick select |
|
|
88
|
+
| `Ctrl+P` | Open command palette |
|
|
89
|
+
| `q` / `Esc` | Quit |
|
|
324
90
|
|
|
325
|
-
|
|
326
|
-
mux-sesh
|
|
91
|
+
With the default prefix key, secondary actions live behind `ctrl+x`:
|
|
327
92
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
93
|
+
- `ctrl+x s` sessions
|
|
94
|
+
- `ctrl+x p` projects
|
|
95
|
+
- `ctrl+x l` last session
|
|
96
|
+
- `ctrl+x g` git root session
|
|
97
|
+
- `ctrl+x r` rename session
|
|
98
|
+
- `ctrl+x e` edit configured target
|
|
99
|
+
- `ctrl+x Shift+R` refresh
|
|
332
100
|
|
|
333
|
-
|
|
101
|
+
In vim mode, `s` and `p` are also available as direct view switches.
|
|
334
102
|
|
|
335
|
-
|
|
103
|
+
Full keybinding reference: [docs/keybindings.md](docs/keybindings.md)
|
|
336
104
|
|
|
337
|
-
|
|
338
|
-
- **Active**: `#a6e3a1` (Green)
|
|
339
|
-
- **Inactive**: `#6c7086` (Gray)
|
|
340
|
-
- **Border**: `#89b4fa` (Blue)
|
|
341
|
-
- **Key**: `#f9e2af` (Yellow)
|
|
342
|
-
- **Action**: `#cba6f7` (Mauve)
|
|
105
|
+
## Docs
|
|
343
106
|
|
|
344
|
-
|
|
107
|
+
- [Configuration](docs/configuration.md)
|
|
108
|
+
- [Keybindings](docs/keybindings.md)
|
|
109
|
+
- [Workflows](docs/workflows.md)
|
|
345
110
|
|
|
346
111
|
## Development
|
|
347
112
|
|
|
348
113
|
```bash
|
|
349
|
-
# Install dependencies
|
|
350
114
|
bun install
|
|
351
|
-
|
|
352
|
-
# Run in dev mode (with hot reload)
|
|
353
|
-
bun run dev
|
|
354
|
-
|
|
355
|
-
# Type check
|
|
356
115
|
bun run typecheck
|
|
357
|
-
|
|
358
|
-
# Build for production
|
|
359
|
-
bun run build
|
|
116
|
+
bun test
|
|
360
117
|
```
|
|
361
118
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
365
|
-
|
|
366
|
-
1. Fork the repository
|
|
367
|
-
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
368
|
-
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
369
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
370
|
-
5. Open a Pull Request
|
|
119
|
+
Use `bun run build` only when you need the compiled binary in `dist/mux-sesh`.
|
|
371
120
|
|
|
372
121
|
## License
|
|
373
122
|
|
|
374
|
-
MIT
|
|
123
|
+
MIT. See [LICENSE](LICENSE).
|
|
375
124
|
|
|
376
|
-
##
|
|
125
|
+
## Related
|
|
377
126
|
|
|
378
|
-
-
|
|
127
|
+
- [mux-manager](https://github.com/quiet-ghost/mux-manager) for Telescope-based tmux session management inside Neovim
|
|
379
128
|
- Built with [OpenTUI](https://github.com/anomalyco/opentui)
|
|
380
|
-
- UI design inspired by [nvim telescope plugin](https://github.com/nvim-telescope/telescope.nvim)
|
|
381
|
-
|
|
382
|
-
## Related Projects
|
|
383
|
-
|
|
384
|
-
- [mux-manager](https://github.com/quiet-ghost/mux-manager) - Telescope-based tmux session manager for Neovim
|
|
385
|
-
|
|
386
|
-
---
|
|
387
|
-
|
|
388
|
-
<p align="center">
|
|
389
|
-
Made with using <a href="https://github.com/anomalyco/opentui">OpenTUI</a> and <a href="https://bun.sh">Bun</a>
|
|
390
|
-
</p>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "mux-sesh",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.8.0",
|
|
5
5
|
"description": "A beautiful tmux session manager built with OpenTUI - fuzzy search sessions, manage projects, clone from GitHub",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"packageManager": "bun@1.3.5",
|
package/src/app/commands.ts
CHANGED
|
@@ -15,6 +15,7 @@ interface ExecuteCommandContext {
|
|
|
15
15
|
openRenameModal: (sessionName: string) => void
|
|
16
16
|
openSettingsModal: () => void
|
|
17
17
|
requestKillSession: (sessionName: string) => void
|
|
18
|
+
togglePinnedSession: (sessionName: string) => Promise<void>
|
|
18
19
|
setAppMode: (mode: AppMode) => void
|
|
19
20
|
setViewMode: (mode: ViewMode) => void
|
|
20
21
|
setAllItems: (items: Item[]) => void
|
|
@@ -87,6 +88,15 @@ export async function executeCommand(commandID: CommandId, ctx: ExecuteCommandCo
|
|
|
87
88
|
}
|
|
88
89
|
return
|
|
89
90
|
}
|
|
91
|
+
case 'toggle-pin-session': {
|
|
92
|
+
const target =
|
|
93
|
+
ctx.viewMode === ViewMode.Sessions ? ctx.regularSessions[ctx.cursor] : undefined
|
|
94
|
+
if (target) {
|
|
95
|
+
ctx.closeModal()
|
|
96
|
+
await ctx.togglePinnedSession(target.title)
|
|
97
|
+
}
|
|
98
|
+
return
|
|
99
|
+
}
|
|
90
100
|
case 'last-session':
|
|
91
101
|
ctx.closeModal()
|
|
92
102
|
await ctx.handleLastSession()
|
package/src/app/controller.ts
CHANGED
|
@@ -193,6 +193,7 @@ export function useAppController() {
|
|
|
193
193
|
handleNewSessionSubmit,
|
|
194
194
|
handleSettingsEditorSubmit,
|
|
195
195
|
handleSettingOptionSubmit,
|
|
196
|
+
handleTogglePinnedSessionWrapper,
|
|
196
197
|
executeCommand,
|
|
197
198
|
} = createAppHandlers({
|
|
198
199
|
appMode,
|
|
@@ -270,6 +271,7 @@ export function useAppController() {
|
|
|
270
271
|
closeModal,
|
|
271
272
|
clearPendingKill,
|
|
272
273
|
requestKillSession,
|
|
274
|
+
togglePinnedSession: handleTogglePinnedSessionWrapper,
|
|
273
275
|
openRenameModal,
|
|
274
276
|
openCommandsModal,
|
|
275
277
|
openSettingsModal,
|
package/src/app/data.ts
CHANGED
|
@@ -41,7 +41,11 @@ export async function loadSessionItems(
|
|
|
41
41
|
getListedSessionItems(config)
|
|
42
42
|
)
|
|
43
43
|
const sessionItems = clearMatchIndices(
|
|
44
|
-
orderSessionItems(
|
|
44
|
+
orderSessionItems(
|
|
45
|
+
mergeSessionItems(visibleSessions, listedSessions),
|
|
46
|
+
config.sortOrder,
|
|
47
|
+
config.pinnedSessions
|
|
48
|
+
)
|
|
45
49
|
)
|
|
46
50
|
|
|
47
51
|
return {
|
package/src/app/handlers.ts
CHANGED
|
@@ -167,6 +167,39 @@ export async function handleSettingOptionSubmitWithFeedback(
|
|
|
167
167
|
)
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
+
export function getPinnedSessionsAfterToggle(config: Config, sessionName: string): string[] {
|
|
171
|
+
const pinnedSessions = config.pinnedSessions ?? []
|
|
172
|
+
|
|
173
|
+
return pinnedSessions.includes(sessionName)
|
|
174
|
+
? pinnedSessions.filter(pinnedSession => pinnedSession !== sessionName)
|
|
175
|
+
: [...pinnedSessions, sessionName]
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export async function handleTogglePinnedSessionWithFeedback(
|
|
179
|
+
sessionName: string,
|
|
180
|
+
options: SettingsHandlerOptions
|
|
181
|
+
): Promise<void> {
|
|
182
|
+
if (!options.config) {
|
|
183
|
+
return
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const pinnedSessions = getPinnedSessionsAfterToggle(options.config, sessionName)
|
|
187
|
+
const nextConfig = {
|
|
188
|
+
...options.config,
|
|
189
|
+
pinnedSessions,
|
|
190
|
+
}
|
|
191
|
+
const isPinned = pinnedSessions.includes(sessionName)
|
|
192
|
+
|
|
193
|
+
await persistConfigUpdate(
|
|
194
|
+
nextConfig,
|
|
195
|
+
`Session '${sessionName}' ${isPinned ? 'pinned' : 'unpinned'}`,
|
|
196
|
+
options.saveConfig,
|
|
197
|
+
options.setConfig,
|
|
198
|
+
options.refreshItems,
|
|
199
|
+
options.showMessage
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
|
|
170
203
|
export async function executeAppCommand(
|
|
171
204
|
commandID: Parameters<typeof runCommand>[0],
|
|
172
205
|
options: Parameters<typeof runCommand>[1]
|
|
@@ -279,6 +312,19 @@ export function createAppHandlers(options: CreateAppHandlersOptions) {
|
|
|
279
312
|
})
|
|
280
313
|
}
|
|
281
314
|
|
|
315
|
+
async function handleTogglePinnedSessionWrapper(sessionName: string) {
|
|
316
|
+
await handleTogglePinnedSessionWithFeedback(sessionName, {
|
|
317
|
+
config: options.config,
|
|
318
|
+
saveConfig: options.saveConfig,
|
|
319
|
+
setConfig: options.setConfig,
|
|
320
|
+
setSettingEditorError: options.setSettingEditorError,
|
|
321
|
+
openSettingsModal: options.openSettingsModal,
|
|
322
|
+
settingEditorValue: options.settingEditorValue,
|
|
323
|
+
refreshItems: options.refreshItems,
|
|
324
|
+
showMessage: options.showMessage,
|
|
325
|
+
})
|
|
326
|
+
}
|
|
327
|
+
|
|
282
328
|
async function executeCommand(commandID: Parameters<typeof executeAppCommand>[0]) {
|
|
283
329
|
await executeAppCommand(commandID, {
|
|
284
330
|
appMode: options.appMode,
|
|
@@ -294,6 +340,7 @@ export function createAppHandlers(options: CreateAppHandlersOptions) {
|
|
|
294
340
|
openRenameModal: options.openRenameModal,
|
|
295
341
|
openSettingsModal: options.openSettingsModal,
|
|
296
342
|
requestKillSession: options.requestKillSession,
|
|
343
|
+
togglePinnedSession: handleTogglePinnedSessionWrapper,
|
|
297
344
|
setAppMode: options.setAppMode,
|
|
298
345
|
setViewMode: options.setViewMode,
|
|
299
346
|
setAllItems: options.setAllItems,
|
|
@@ -320,6 +367,7 @@ export function createAppHandlers(options: CreateAppHandlersOptions) {
|
|
|
320
367
|
handleNewSessionSubmit,
|
|
321
368
|
handleSettingsEditorSubmit,
|
|
322
369
|
handleSettingOptionSubmit,
|
|
370
|
+
handleTogglePinnedSessionWrapper,
|
|
323
371
|
executeCommand,
|
|
324
372
|
}
|
|
325
373
|
}
|
package/src/app/keyboard.ts
CHANGED
|
@@ -52,6 +52,7 @@ interface UseAppKeyboardOptions {
|
|
|
52
52
|
closeModal: () => void
|
|
53
53
|
clearPendingKill: () => void
|
|
54
54
|
requestKillSession: (sessionName: string) => void
|
|
55
|
+
togglePinnedSession: (sessionName: string) => Promise<void>
|
|
55
56
|
openRenameModal: (sessionName: string) => void
|
|
56
57
|
openCommandsModal: () => void
|
|
57
58
|
openSettingsModal: () => void
|
|
@@ -101,6 +102,7 @@ export function useAppKeyboard(options: UseAppKeyboardOptions) {
|
|
|
101
102
|
setPrefixActive: options.setPrefixActive,
|
|
102
103
|
refreshItems: options.refreshItems,
|
|
103
104
|
requestKillSession: options.requestKillSession,
|
|
105
|
+
togglePinnedSession: options.togglePinnedSession,
|
|
104
106
|
clearPendingKill: options.clearPendingKill,
|
|
105
107
|
handleSelect: options.handleSelect,
|
|
106
108
|
handleKillSession: options.handleKillSession,
|
package/src/config/index.ts
CHANGED
|
@@ -51,6 +51,24 @@ function asStringArray(value: unknown): string[] | undefined {
|
|
|
51
51
|
return strings.length > 0 ? strings : undefined
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
function uniqueStrings(values?: string[]): string[] | undefined {
|
|
55
|
+
if (!values || values.length === 0) {
|
|
56
|
+
return undefined
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const seen = new Set<string>()
|
|
60
|
+
const unique = values.filter(value => {
|
|
61
|
+
if (seen.has(value)) {
|
|
62
|
+
return false
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
seen.add(value)
|
|
66
|
+
return true
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
return unique.length > 0 ? unique : undefined
|
|
70
|
+
}
|
|
71
|
+
|
|
54
72
|
function asKeybindMode(value: unknown): KeybindMode | undefined {
|
|
55
73
|
return value === 'vim' || value === 'standard' ? value : undefined
|
|
56
74
|
}
|
|
@@ -320,6 +338,9 @@ export function normalizeConfig(rawConfig: unknown, homeDir = process.env.HOME |
|
|
|
320
338
|
asStringArray(raw.hidden_sessions) ??
|
|
321
339
|
asStringArray(raw.hiddenSessions) ??
|
|
322
340
|
defaultConfig.hiddenSessions
|
|
341
|
+
const pinnedSessions =
|
|
342
|
+
uniqueStrings(asStringArray(raw.pinned_sessions) ?? asStringArray(raw.pinnedSessions)) ??
|
|
343
|
+
defaultConfig.pinnedSessions
|
|
323
344
|
const icons = normalizeIcons(raw.icons) ?? defaultConfig.icons
|
|
324
345
|
const configuredDefaultSession =
|
|
325
346
|
normalizeSessionDefaults(raw.default_session) ?? normalizeSessionDefaults(raw.defaultSession)
|
|
@@ -343,6 +364,7 @@ export function normalizeConfig(rawConfig: unknown, homeDir = process.env.HOME |
|
|
|
343
364
|
autoUpdate,
|
|
344
365
|
dirLength,
|
|
345
366
|
hiddenSessions,
|
|
367
|
+
pinnedSessions,
|
|
346
368
|
icons,
|
|
347
369
|
defaultSession,
|
|
348
370
|
projects: normalizeProjectProfiles(raw.projects, homeDir) ?? defaultConfig.projects,
|
|
@@ -366,6 +388,7 @@ export function getDefaultConfig(homeDir = process.env.HOME || '~'): Config {
|
|
|
366
388
|
autoUpdate: true,
|
|
367
389
|
dirLength: 1,
|
|
368
390
|
hiddenSessions: [],
|
|
391
|
+
pinnedSessions: [],
|
|
369
392
|
icons: DEFAULT_ICONS,
|
|
370
393
|
defaultSession: {
|
|
371
394
|
startupCommand: DEFAULT_EDITOR_COMMAND,
|
|
@@ -401,6 +424,7 @@ export function serializeConfig(config: Config): Record<string, unknown> {
|
|
|
401
424
|
auto_update: config.autoUpdate,
|
|
402
425
|
dir_length: config.dirLength,
|
|
403
426
|
hidden_sessions: config.hiddenSessions,
|
|
427
|
+
pinned_sessions: config.pinnedSessions,
|
|
404
428
|
icons: config.icons,
|
|
405
429
|
default_session: config.defaultSession
|
|
406
430
|
? {
|
|
@@ -111,6 +111,15 @@ export function handleNormalMode(
|
|
|
111
111
|
return
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
if (key.ctrl && keyName === 'f') {
|
|
115
|
+
const item = ctx.viewMode === ViewMode.Sessions ? ctx.regularSessions[ctx.cursor] : undefined
|
|
116
|
+
if (item) {
|
|
117
|
+
ctx.clearPendingKill()
|
|
118
|
+
void ctx.togglePinnedSession(item.title)
|
|
119
|
+
}
|
|
120
|
+
return
|
|
121
|
+
}
|
|
122
|
+
|
|
114
123
|
if (!ctx.prefixKey && !isStandard && keyName === 'l') {
|
|
115
124
|
ctx.clearPendingKill()
|
|
116
125
|
void ctx.handleLastSession()
|
|
@@ -31,6 +31,7 @@ export interface KeyboardHandlerContext {
|
|
|
31
31
|
setPrefixActive: (active: boolean) => void
|
|
32
32
|
refreshItems: (forceViewMode?: ViewMode, nextConfig?: Config) => Promise<void>
|
|
33
33
|
requestKillSession: (sessionName: string) => void
|
|
34
|
+
togglePinnedSession: (sessionName: string) => Promise<void>
|
|
34
35
|
clearPendingKill: () => void
|
|
35
36
|
handleSelect: (item: Item) => Promise<void>
|
|
36
37
|
handleKillSession: (sessionName: string) => Promise<void>
|
package/src/items/order.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Item, SortOrder } from '../types'
|
|
2
2
|
import { getLiveSessionSortKey } from '../util/path-display'
|
|
3
3
|
|
|
4
|
+
export type SessionSection = 'pinned' | 'live' | 'configured'
|
|
5
|
+
|
|
4
6
|
function compareByTitle(left: Item, right: Item): number {
|
|
5
7
|
return left.title.localeCompare(right.title)
|
|
6
8
|
}
|
|
@@ -25,6 +27,27 @@ function isConfiguredSession(item: Item): boolean {
|
|
|
25
27
|
return item.itemKind === 'configured'
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
function applyPinnedState(items: Item[], pinnedSessions: readonly string[]): Item[] {
|
|
31
|
+
const pinnedSet = new Set(pinnedSessions)
|
|
32
|
+
|
|
33
|
+
return items.map(item => ({
|
|
34
|
+
...item,
|
|
35
|
+
isPinned: pinnedSet.has(item.title),
|
|
36
|
+
}))
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function splitPinnedItems(items: Item[], pinnedSessions: readonly string[]) {
|
|
40
|
+
const itemByTitle = new Map(items.map(item => [item.title, item]))
|
|
41
|
+
const pinnedItems = pinnedSessions.flatMap(title => {
|
|
42
|
+
const item = itemByTitle.get(title)
|
|
43
|
+
return item ? [item] : []
|
|
44
|
+
})
|
|
45
|
+
const pinnedSet = new Set(pinnedItems.map(item => item.title))
|
|
46
|
+
const remainingItems = items.filter(item => !pinnedSet.has(item.title))
|
|
47
|
+
|
|
48
|
+
return { pinnedItems, remainingItems }
|
|
49
|
+
}
|
|
50
|
+
|
|
28
51
|
function sortByGroup(items: Item[], groups: Array<'live' | 'configured'>): Item[] {
|
|
29
52
|
const configuredItems = items.filter(isConfiguredSession).sort(compareByTitle)
|
|
30
53
|
const liveItems = items.filter(item => !isConfiguredSession(item)).sort(compareLiveSessions)
|
|
@@ -36,24 +59,30 @@ function sortByGroup(items: Item[], groups: Array<'live' | 'configured'>): Item[
|
|
|
36
59
|
return groups.flatMap(group => groupedItems.get(group) ?? [])
|
|
37
60
|
}
|
|
38
61
|
|
|
39
|
-
export function orderSessionItems(
|
|
40
|
-
|
|
41
|
-
|
|
62
|
+
export function orderSessionItems(
|
|
63
|
+
items: Item[],
|
|
64
|
+
sortOrder: SortOrder = 'live-first',
|
|
65
|
+
pinnedSessions: readonly string[] = []
|
|
66
|
+
): Item[] {
|
|
67
|
+
const itemsWithPinnedState = applyPinnedState(items, pinnedSessions)
|
|
68
|
+
const opencodeItems = itemsWithPinnedState.filter(isOpencodeSession).sort(compareByTitle)
|
|
69
|
+
const regularItems = itemsWithPinnedState.filter(item => !isOpencodeSession(item))
|
|
70
|
+
const { pinnedItems, remainingItems } = splitPinnedItems(regularItems, pinnedSessions)
|
|
42
71
|
|
|
43
72
|
const orderedRegularItems =
|
|
44
73
|
sortOrder === 'configured-first'
|
|
45
|
-
? sortByGroup(
|
|
74
|
+
? sortByGroup(remainingItems, ['configured', 'live'])
|
|
46
75
|
: sortOrder === 'alphabetical'
|
|
47
|
-
? [...
|
|
76
|
+
? [...remainingItems].sort((left, right) => {
|
|
48
77
|
if (isConfiguredSession(left) || isConfiguredSession(right)) {
|
|
49
78
|
return compareByTitle(left, right)
|
|
50
79
|
}
|
|
51
80
|
|
|
52
81
|
return compareLiveSessions(left, right)
|
|
53
82
|
})
|
|
54
|
-
: sortByGroup(
|
|
83
|
+
: sortByGroup(remainingItems, ['live', 'configured'])
|
|
55
84
|
|
|
56
|
-
return [...orderedRegularItems, ...opencodeItems]
|
|
85
|
+
return [...pinnedItems, ...orderedRegularItems, ...opencodeItems]
|
|
57
86
|
}
|
|
58
87
|
|
|
59
88
|
export function orderProjectItems(items: Item[], sortOrder: SortOrder = 'live-first'): Item[] {
|
|
@@ -64,6 +93,10 @@ export function orderProjectItems(items: Item[], sortOrder: SortOrder = 'live-fi
|
|
|
64
93
|
return items
|
|
65
94
|
}
|
|
66
95
|
|
|
67
|
-
export function getSessionSection(item: Item):
|
|
96
|
+
export function getSessionSection(item: Item): SessionSection {
|
|
97
|
+
if (item.isPinned) {
|
|
98
|
+
return 'pinned'
|
|
99
|
+
}
|
|
100
|
+
|
|
68
101
|
return item.itemKind === 'configured' ? 'configured' : 'live'
|
|
69
102
|
}
|
package/src/search/index.ts
CHANGED
package/src/settings.ts
CHANGED
|
@@ -18,6 +18,7 @@ export type SettingsFieldId =
|
|
|
18
18
|
| 'defaultPreviewCommand'
|
|
19
19
|
| 'projectPaths'
|
|
20
20
|
| 'hiddenSessions'
|
|
21
|
+
| 'pinnedSessions'
|
|
21
22
|
| 'icons'
|
|
22
23
|
| 'projects'
|
|
23
24
|
| 'wildcards'
|
|
@@ -301,6 +302,18 @@ const SETTINGS_FIELDS: readonly SettingsFieldDefinition[] = [
|
|
|
301
302
|
raw.hidden_sessions = JSON.parse(value) as unknown
|
|
302
303
|
},
|
|
303
304
|
},
|
|
305
|
+
{
|
|
306
|
+
id: 'pinnedSessions',
|
|
307
|
+
label: 'Pinned Sessions',
|
|
308
|
+
hint: 'JSON array of session names',
|
|
309
|
+
kind: 'json',
|
|
310
|
+
title: 'Pinned Sessions',
|
|
311
|
+
getValue: config => `${config.pinnedSessions?.length ?? 0} pinned`,
|
|
312
|
+
getEditorValue: config => formatJSON(config.pinnedSessions ?? []),
|
|
313
|
+
applyEditor: (raw, value) => {
|
|
314
|
+
raw.pinned_sessions = JSON.parse(value) as unknown
|
|
315
|
+
},
|
|
316
|
+
},
|
|
304
317
|
{
|
|
305
318
|
id: 'icons',
|
|
306
319
|
label: 'Icons',
|
package/src/types/index.ts
CHANGED
|
@@ -142,6 +142,7 @@ export interface Item {
|
|
|
142
142
|
isSession: boolean
|
|
143
143
|
itemKind?: ItemKind
|
|
144
144
|
icon?: string
|
|
145
|
+
isPinned?: boolean
|
|
145
146
|
isAttached?: boolean
|
|
146
147
|
linkedSessionName?: string
|
|
147
148
|
linkedSessionAttached?: boolean
|
|
@@ -162,6 +163,7 @@ export interface Config {
|
|
|
162
163
|
autoUpdate?: boolean
|
|
163
164
|
dirLength?: number
|
|
164
165
|
hiddenSessions?: string[]
|
|
166
|
+
pinnedSessions?: string[]
|
|
165
167
|
zoxideMode?: ZoxideMode
|
|
166
168
|
sortOrder?: SortOrder
|
|
167
169
|
theme?: string
|
package/src/ui/CommandsModal.tsx
CHANGED
|
@@ -12,6 +12,7 @@ export type CommandId =
|
|
|
12
12
|
| 'view-sessions'
|
|
13
13
|
| 'rename-session'
|
|
14
14
|
| 'kill-session'
|
|
15
|
+
| 'toggle-pin-session'
|
|
15
16
|
| 'last-session'
|
|
16
17
|
| 'root-session'
|
|
17
18
|
| 'edit-target'
|
|
@@ -69,6 +70,16 @@ export function getCommandEntries(
|
|
|
69
70
|
{ id: 'new-session', category: 'Direct', title: 'New session', keybind: 'n' },
|
|
70
71
|
{ id: 'open-opencode', category: 'Direct', title: 'Open OpenCode sessions', keybind: 'o' },
|
|
71
72
|
{ id: 'kill-session', category: 'Direct', title: 'Kill session', keybind: 'd' },
|
|
73
|
+
...(selectedItem && (selectedItem.isSession || selectedItem.itemKind === 'configured')
|
|
74
|
+
? [
|
|
75
|
+
{
|
|
76
|
+
id: 'toggle-pin-session' as const,
|
|
77
|
+
category: 'Direct',
|
|
78
|
+
title: selectedItem.isPinned ? 'Unpin session' : 'Pin session',
|
|
79
|
+
keybind: 'ctrl+f',
|
|
80
|
+
},
|
|
81
|
+
]
|
|
82
|
+
: []),
|
|
72
83
|
{ id: 'open-settings', category: 'Direct', title: 'Open settings', keybind: 'ctrl+p' },
|
|
73
84
|
{
|
|
74
85
|
id: 'view-projects',
|
package/src/ui/Toast.tsx
CHANGED
|
@@ -15,16 +15,19 @@ export default function Toast({ message, visible }: ToastProps) {
|
|
|
15
15
|
style={{
|
|
16
16
|
position: 'absolute',
|
|
17
17
|
top: 1,
|
|
18
|
-
right:
|
|
19
|
-
backgroundColor: theme.surfaceAlt,
|
|
20
|
-
paddingLeft: 1,
|
|
21
|
-
paddingRight: 1,
|
|
22
|
-
height: 2,
|
|
18
|
+
right: 2,
|
|
23
19
|
}}
|
|
24
20
|
>
|
|
25
|
-
<box
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
<box
|
|
22
|
+
style={{
|
|
23
|
+
flexDirection: 'row',
|
|
24
|
+
backgroundColor: theme.surface,
|
|
25
|
+
paddingTop: 1,
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<text style={{ fg: theme.action }}>▎</text>
|
|
29
|
+
<text style={{ fg: theme.text, marginLeft: 1, marginRight: 1 }}>{message}</text>
|
|
30
|
+
<text style={{ fg: theme.action }}>▎</text>
|
|
28
31
|
</box>
|
|
29
32
|
</box>
|
|
30
33
|
)
|
package/src/ui/item-icon.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SessionSection } from '../items/order'
|
|
1
2
|
import type { IconConfig, Item, ThemeColors } from '../types'
|
|
2
3
|
|
|
3
4
|
export interface ItemIconPresentation {
|
|
@@ -52,12 +53,14 @@ export function getItemIconPresentation(
|
|
|
52
53
|
|
|
53
54
|
export function getSessionSectionPresentation(
|
|
54
55
|
theme: ThemeColors,
|
|
55
|
-
section:
|
|
56
|
+
section: SessionSection | 'opencode',
|
|
56
57
|
icons?: IconConfig
|
|
57
58
|
): ItemIconPresentation & { label: string } {
|
|
58
59
|
const resolvedIcons = getIconConfig(icons)
|
|
59
60
|
|
|
60
61
|
switch (section) {
|
|
62
|
+
case 'pinned':
|
|
63
|
+
return { glyph: '', color: theme.accent, label: 'Pinned' }
|
|
61
64
|
case 'configured':
|
|
62
65
|
return { glyph: resolvedIcons.configured, color: theme.action, label: 'Configured' }
|
|
63
66
|
case 'opencode':
|
|
@@ -69,7 +72,7 @@ export function getSessionSectionPresentation(
|
|
|
69
72
|
|
|
70
73
|
export function formatSectionHeader(
|
|
71
74
|
theme: ThemeColors,
|
|
72
|
-
section:
|
|
75
|
+
section: SessionSection | 'opencode',
|
|
73
76
|
icons?: IconConfig
|
|
74
77
|
): ItemIconPresentation & { text: string } {
|
|
75
78
|
const presentation = getSessionSectionPresentation(theme, section, icons)
|