Files
javis_bot/app/tests/vdisplay_elevated.rs
javis-bot 1bd7defbb4 feat(app): the bot browser's window on a virtual monitor to share in Discord
- features.browserShare (봇용 크롬창 화면공유 선택 표시, off by default) and a driver card on the
  features screen: the Virtual Display Driver 25.7.23 (MIT, SignPath-signed) ships in
  display-driver/ (hash-checked by package.sh); install and uninstall run jarvis.exe elevated
  once (--display-driver), settings in %ProgramData%\JarvisBot\display-driver, another
  program's copy of the driver is left alone
- the monitor is on the desktop only while the bot browser uses it, at the rightmost real
  monitor's bottom-right corner; the stop closes Chrome first, then takes the monitor off
- Chrome starts with no window and the app opens it over CDP in the background, so it never
  takes the focus; the window is a tool window (no Alt+Tab, no taskbar button), fills the
  monitor's work area and keeps drawing when covered; without a monitor it runs headless with
  the reason on the dashboard
- Chrome runs with --do-not-de-elevate on Windows: started by an app running as administrator
  it restarted itself as the user and the app lost hold of it
- checked on the win-ci Windows VM from install to uninstall (focus kept while typing, no
  taskbar button, no Chrome left, nothing left after uninstall) and on Linux with a real Chrome

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 02:43:32 +09:00

24 lines
1.2 KiB
Rust

//! Installing and removing the virtual monitor's driver through the app's elevated half
//! (admin.spec.md, "Virtual monitor"). Windows only, with the driver files in `display-driver/` next
//! to this program and `JARVIS_TEST_VDISPLAY=install` or `uninstall`; Windows asks for the
//! administrator (and on install whether to trust the SignPath Foundation). Elsewhere it skips.
//! No test harness: started elevated, this same program is the elevated half.
fn main() {
let args: Vec<String> = std::env::args().collect();
if let Some(code) = jarvis_app::vdisplay::elevated_main(&args) {
std::process::exit(code);
}
let Ok(action) = std::env::var("JARVIS_TEST_VDISPLAY") else {
eprintln!("skipped: set JARVIS_TEST_VDISPLAY=install|uninstall");
return;
};
let rt = tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap();
let outcome = rt.block_on(jarvis_app::vdisplay::run_elevated(&action));
let status = jarvis_app::vdisplay::status();
println!("{action}: {outcome:?} -> {status:?}");
outcome.expect("the elevated half succeeds");
assert_eq!(status.installed, action == "install");
assert!(!status.other);
}