fix(display): fail fast on invalid mode in display_control path; update docs
- Primary display_control path now validates mode explicitly ('mirror'|'extend')
and returns an error instead of silently defaulting to extend.
Passes mode directly to binary (simpler, avoids redundant ternary).
- README: update set_display_layout bridge table row to correctly describe
display_control as primary and displayplacer as fallback.
- README: add one-time 'Build display_control Binary' section in Development
with xcode-select, build, test, and git commit steps.
This commit is contained in:
@@ -335,8 +335,10 @@ export function registerSystemHandlers() {
|
||||
: path.join(__dirname, '../../resources/bin/display_control');
|
||||
|
||||
if (fs.existsSync(dc_bin) && !configStr) {
|
||||
const dc_cmd = mode === 'mirror' ? 'mirror' : 'extend';
|
||||
return await runExec(`"${dc_bin}" ${dc_cmd}`);
|
||||
if (mode !== 'mirror' && mode !== 'extend') {
|
||||
return { success: false, error: `Unsupported display mode: ${mode}` };
|
||||
}
|
||||
return await runExec(`"${dc_bin}" ${mode}`);
|
||||
}
|
||||
|
||||
// Fallback: displayplacer — required when display_control binary is not built yet,
|
||||
|
||||
Reference in New Issue
Block a user