Hide console window, add Debug Window tray option
- Hide console window by default (windows_subsystem = "windows") - Add "Show Debug Window" menu item to tray - AllocConsole when debug window requested - Console shows logs for troubleshooting 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,9 @@
|
||||
//! If a support code is provided, the agent will connect using that code
|
||||
//! for a one-time support session.
|
||||
|
||||
// Hide console window by default on Windows (release builds)
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
mod capture;
|
||||
mod chat;
|
||||
mod config;
|
||||
@@ -34,6 +37,10 @@ use windows::core::PCWSTR;
|
||||
use windows::Win32::Security::{GetTokenInformation, TokenElevation, TOKEN_ELEVATION, TOKEN_QUERY};
|
||||
#[cfg(windows)]
|
||||
use windows::Win32::System::Threading::{GetCurrentProcess, OpenProcessToken};
|
||||
#[cfg(windows)]
|
||||
use windows::Win32::System::Console::{AllocConsole, FreeConsole, GetConsoleWindow};
|
||||
#[cfg(windows)]
|
||||
use windows::Win32::UI::WindowsAndMessaging::{ShowWindow, SW_SHOW, SW_HIDE};
|
||||
|
||||
/// Extract a 6-digit support code from the executable's filename.
|
||||
/// Looks for patterns like "GuruConnect-123456.exe" or "123456.exe"
|
||||
@@ -125,6 +132,29 @@ fn show_message_box(_title: &str, _message: &str) {
|
||||
// No-op on non-Windows platforms
|
||||
}
|
||||
|
||||
/// Show the debug console window (Windows only)
|
||||
#[cfg(windows)]
|
||||
fn show_debug_console() {
|
||||
unsafe {
|
||||
// Check if we already have a console
|
||||
let hwnd = GetConsoleWindow();
|
||||
if hwnd.0 == std::ptr::null_mut() {
|
||||
// No console, allocate one
|
||||
let _ = AllocConsole();
|
||||
info!("Debug console window opened");
|
||||
} else {
|
||||
// Console exists, make sure it's visible
|
||||
let _ = ShowWindow(hwnd, SW_SHOW);
|
||||
info!("Debug console window shown");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
fn show_debug_console() {
|
||||
// No-op on non-Windows platforms
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
// Initialize logging
|
||||
|
||||
Reference in New Issue
Block a user