breadhelp/src/main.rs
Breadway 29b2445573 breadhelp 0.2.0: live guided tour overlay replacing static onboarding
Replaces the old in-window onboarding wizard with a real screen-wide
tour: dim + spotlight cutout around the actual on-screen component
(breadbar, breadbox), floating callout teaching the shortcut, and
event-driven confirmation via real Hyprland/breadd signals instead of
click-through fakery.
2026-07-15 18:48:10 +08:00

42 lines
1.5 KiB
Rust

mod cli;
mod config;
mod content;
mod services;
mod theme;
mod ui;
use gtk4::gio::ApplicationFlags;
use gtk4::prelude::*;
fn main() {
// GApplication requires a dotted id (g_application_id_is_valid rejects a
// bare "breadhelp" with a GLib-GIO-CRITICAL and silently skips setting
// it, which would break D-Bus single-instance activation). The Wayland
// app-id GTK reports is this exact string — the Hyprland window rule and
// .desktop's StartupWMClass must match it verbatim.
//
// HANDLES_COMMAND_LINE: `breadhelp --onboard` while already running must
// reach the running (primary) instance's argv, not just re-activate it
// with no arguments — that's what lets a second launch re-trigger the
// onboarding tour instead of only focusing the window.
let app = gtk4::Application::builder()
.application_id("com.breadway.breadhelp")
.flags(ApplicationFlags::HANDLES_COMMAND_LINE)
.build();
app.connect_command_line(|app, cmdline| {
let action = cli::parse(&cmdline.arguments());
ui::window::present(app, action);
glib::ExitCode::SUCCESS
});
// Best-effort revert of a tour step's temporarily-rebound keybind (see
// `ui::tour`'s crash-safety notes) on a clean exit — `rebind_temp` is a
// detached fire-and-forget `hyprctl` spawn, so it still completes even
// though this process is exiting right after.
app.connect_shutdown(|_| {
ui::tour::self_heal();
});
app.run();
}