Skip to content

Commit 074ce1d

Browse files
committed
enable manual theme refresh in init-app
1 parent 3debb2d commit 074ce1d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

cli/src/init/init-app.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { initializeThemeStore } from '../hooks/use-theme'
44
import { setProjectRoot } from '../project-files'
55
import { runOscDetectionSubprocess } from './osc-subprocess'
66
import { findGitRoot } from '../utils/git'
7+
import { enableManualThemeRefresh } from '../utils/theme-system'
78

89
export async function initializeApp(params: {
910
cwd?: string
@@ -24,4 +25,6 @@ export async function initializeApp(params: {
2425
enableMapSet()
2526

2627
initializeThemeStore()
28+
29+
enableManualThemeRefresh()
2730
}

cli/src/utils/theme-system.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { existsSync, readFileSync, readdirSync, statSync, watch } from 'fs'
22
import { homedir } from 'os'
33
import { dirname, join } from 'path'
44

5-
import { detectShell } from './detect-shell'
65
import { logger } from './logger'
76
import { detectTerminalTheme } from './terminal-color-detection'
87
import { withTerminalInputGuard } from './terminal-input-guard'
@@ -1113,9 +1112,11 @@ export const setupFileWatchers = () => {
11131112
* SIGUSR2 signal handler for manual theme refresh
11141113
* Users can send `kill -USR2 <pid>` to force theme recomputation
11151114
*/
1116-
process.on('SIGUSR2', () => {
1117-
recomputeSystemTheme('signal:SIGUSR2')
1118-
})
1115+
export function enableManualThemeRefresh() {
1116+
process.on('SIGUSR2', () => {
1117+
recomputeSystemTheme('signal:SIGUSR2')
1118+
})
1119+
}
11191120

11201121
/**
11211122
* OSC Terminal Theme Detection

0 commit comments

Comments
 (0)