Skip to content

A visual git client, simple to use yet powerful. Light, fast and debloated.

Rust
1.4 KB
Raw Blame
// No console window behind the app on Windows release builds.
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

use std::sync::atomic::Ordering;

use gitcraft::app;

fn main() -> eframe::Result {
    // Started by ssh to ask the user something (see `askpass`): ask the window and exit.
    if let Some(code) = gitcraft::askpass::run_if_asked() {
        std::process::exit(code);
    }
    let options = eframe::NativeOptions {
        viewport: egui::ViewportBuilder::default()
            .with_title("GitCraft")
            // Matches gitcraft.desktop, so Linux desktops show its icon and group its windows.
            .with_app_id("gitcraft")
            .with_inner_size([1400.0, 860.0])
            .with_min_inner_size([800.0, 500.0])
            .with_icon(app::window_icon()),
        // Runs after eframe restored the last session's size and position.
        window_builder: Some(Box::new(|builder| {
            if cfg!(windows) && builder.maximized == Some(true) {
                app::MAXIMIZE_WHEN_SHOWN.store(true, Ordering::Relaxed);
                builder.with_maximized(false)
            } else {
                builder
            }
        })),
        ..Default::default()
    };
    eframe::run_native(
        "gitcraft",
        options,
        Box::new(|cc| {
            let open_arg = std::env::args_os().nth(1).map(std::path::PathBuf::from);
            Ok(Box::new(app::App::new(cc, open_arg)))
        }),
    )
}