docs/build: update README + compiled dist for list-modes/set-mode features
README: - set_display_layout: note idempotent behavior (no flicker if already in state) - add list_display_modes and set_display_mode rows to bridge table - add list-modes and set-mode to Option B test commands dist/: compiled output from tsc (system_handlers, preload, index)
This commit is contained in:
41
dist/main/system_handlers.js
vendored
41
dist/main/system_handlers.js
vendored
@@ -442,6 +442,47 @@ function registerSystemHandlers() {
|
||||
}
|
||||
return { success: false, error: `Unsupported display mode: ${mode}` };
|
||||
});
|
||||
// 6b. List Display Modes
|
||||
electron_1.ipcMain.handle('native:list-display-modes', async () => {
|
||||
if (os.platform() !== 'darwin')
|
||||
return { success: false, error: 'Display control only supported on macOS' };
|
||||
const dc_bin = electron_1.app.isPackaged
|
||||
? path.join(process.resourcesPath, 'bin', 'display_control')
|
||||
: path.join(__dirname, '../../resources/bin/display_control');
|
||||
if (!fs.existsSync(dc_bin)) {
|
||||
return { success: false, error: 'display_control binary not found. Build via scripts/build-display-control.sh.' };
|
||||
}
|
||||
const result = await runExec(`"${dc_bin}" list-modes`);
|
||||
if (!result.success || !result.stdout) {
|
||||
return { success: false, error: result.error ?? 'list-modes returned no output' };
|
||||
}
|
||||
try {
|
||||
const displays = JSON.parse(result.stdout);
|
||||
return { success: true, displays };
|
||||
}
|
||||
catch (e) {
|
||||
return { success: false, error: `Failed to parse list-modes output: ${e.message}`, raw: result.stdout };
|
||||
}
|
||||
});
|
||||
// 6c. Set Display Mode
|
||||
electron_1.ipcMain.handle('native:set-display-mode', async (event, { display_index, width, height, refresh_rate, hidpi }) => {
|
||||
if (os.platform() !== 'darwin')
|
||||
return { success: false, error: 'Display control only supported on macOS' };
|
||||
const dc_bin = electron_1.app.isPackaged
|
||||
? path.join(process.resourcesPath, 'bin', 'display_control')
|
||||
: path.join(__dirname, '../../resources/bin/display_control');
|
||||
if (!fs.existsSync(dc_bin)) {
|
||||
return { success: false, error: 'display_control binary not found. Build via scripts/build-display-control.sh.' };
|
||||
}
|
||||
let cmd = `"${dc_bin}" set-mode ${display_index} ${width} ${height}`;
|
||||
if (refresh_rate)
|
||||
cmd += ` --refresh ${refresh_rate}`;
|
||||
if (hidpi === true)
|
||||
cmd += ' --hidpi';
|
||||
if (hidpi === false)
|
||||
cmd += ' --no-hidpi';
|
||||
return await runExec(cmd);
|
||||
});
|
||||
// 7. Update App
|
||||
electron_1.ipcMain.handle('native:update-app', async (event, { source, url, path: localPath }) => {
|
||||
// 1. Determine Source File
|
||||
|
||||
Reference in New Issue
Block a user