* Find which window+pane a service currently occupies across the entire session. * Works whether the service is in its own named window or joined into window 0.
(sessionName: string, serviceName: string)
| 369 | execSync(`tmux move-window -s ${windowId} -t ${sessionName}`, { |
| 370 | stdio: 'ignore', |
| 371 | }); |
| 372 | |
| 373 | // tmux creates windows from break-pane with automatic-rename enabled. On |
| 374 | // tmux 3.7, the new window is immediately renamed to the shell command |
| 375 | // (for example "zsh"), even when -n is provided. The dev dashboard later |
| 376 | // finds service panes by window name, so pin the service name after moving. |
| 377 | execSync(`tmux set-window-option -t ${windowId} automatic-rename off`, { |
| 378 | stdio: 'ignore', |
| 379 | }); |
| 380 | execSync(`tmux rename-window -t ${windowId} ${escapeForShell(newWindowName)}`, { |
| 381 | stdio: 'ignore', |
| 382 | }); |
| 383 | |
| 384 | // Resolve the session-relative window index from the globally unique |
| 385 | // window ID. The raw #{window_index} from break-pane -P is unreliable |
| 386 | // when the window was created in a different session. |
| 387 | const indexOutput = execSync(`tmux display-message -t ${windowId} -p "#{window_index}"`, { |
| 388 | encoding: 'utf-8', |
| 389 | }).trim(); |
| 390 | return parseInt(indexOutput, 10); |
| 391 | } |
| 392 | |
| 393 | /** Count panes in a window */ |
| 394 | function countPanes(sessionName: string, windowTarget: string | number): number { |
| 395 | try { |
no test coverage detected