rustimal 0.8.0

A minimal, GPU-rendered terminal for Windows that runs Git Bash, with animated split panes and a glass look
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

mod agent;
mod app;
mod cli;
mod config;
mod platform;
mod programs;
mod render;
mod review;
mod review_ui;
mod terminal;
mod ui;

use std::path::PathBuf;

use winit::event_loop::EventLoop;

use crate::app::App;
use crate::terminal::events::UserEvent;

/// Session markers a parent Claude Code process leaves in the environment.
/// Inherited by shells, they make Claude think it is a child session
/// (e.g. it stops saving transcripts), so strip them.
const CLAUDE_SESSION_VARS: &[&str] = &[
    "CLAUDECODE",
    "CLAUDE_PID",
    "CLAUDE_EFFORT",
    "CLAUDE_AGENT_SDK_VERSION",
    "CLAUDE_CODE_CHILD_SESSION",
    "CLAUDE_CODE_SESSION_ID",
    "CLAUDE_CODE_SESSION_ATTENDED",
    "CLAUDE_CODE_ENTRYPOINT",
    "CLAUDE_CODE_EXECPATH",
    "CLAUDE_CODE_MESSAGING_SOCKET",
    "CLAUDE_CODE_MESSAGING_TOKEN",
    "CLAUDE_CODE_SSE_PORT",
];

fn main() {
    for var in CLAUDE_SESSION_VARS {
        // SAFETY: called before any other threads are spawned.
        unsafe { std::env::remove_var(var) };
    }
    env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("warn")).init();

    // Optional first argument: starting directory, or a command like --install.
    let first = std::env::args().nth(1);
    if let Some(code) = first.as_deref().and_then(cli::run) {
        std::process::exit(code);
    }
    // `--layout NAME` opens a saved layout; otherwise the argument is a starting folder.
    let (layout, folder_arg) =
        if first.as_deref() == Some("--layout") { (std::env::args().nth(2), None) } else { (None, first) };
    let explicit_dir = folder_arg.is_some();
    // Explorer passes drive roots as "C:\", which Windows' argument parsing turns into `C:"`.
    let start_dir = folder_arg
        .map(|a| {
            let a = a.trim_end_matches('"').to_string();
            PathBuf::from(if a.ends_with(':') { a + "\\" } else { a })
        })
        .filter(|p| p.is_dir())
        .or_else(dirs::home_dir);

    let event_loop = EventLoop::<UserEvent>::with_user_event().build().expect("event loop");
    let mut config = config::Config::load();
    if cfg!(debug_assertions)
        && let Ok(hotkey) = std::env::var("RUSTIMAL_HOTKEY")
    {
        // For testing the hotkey without touching the config file.
        config.hotkey = hotkey;
    }
    let mut app = App::new(event_loop.create_proxy(), config, start_dir, explicit_dir, layout);
    event_loop.run_app(&mut app).expect("event loop failed");
}