fn start_leftwm() {
    let current_exe = get_current_exe();

    set_env_vars();

    // Boot everything WM agnostic or LeftWM related in ~/.config/autostart
    let mut children = Nanny::autostart();

    let flag = get_sigchld_flag();

    let mut error_occured = false;
    let mut session_exit_status: Option<ExitStatus> = None;
    while !error_occured {
        let mut leftwm_session = start_leftwm_session(&current_exe);
        #[cfg(feature = "lefthk")]
        let mut lefthk_session = start_lefthk_session(&current_exe);

        while session_is_running(&mut leftwm_session) {
            // remove all child processes which finished
            children.remove_finished_children();

            while is_suspending(&flag) {
                nix::unistd::pause();
            }
        }

        // we don't want a rougue lefthk session so we kill it when the leftwm one ended
        #[cfg(feature = "lefthk")]
        kill_lefthk_session(&mut lefthk_session);

        session_exit_status = get_exit_status(&mut leftwm_session);
        error_occured = check_error_occured(session_exit_status);

        // TODO: either add more details or find a better workaround.
        //
        // Left is too fast for some login managers. We need to
        // wait to give the login manager a second to boot.
        #[cfg(feature = "slow-dm-fix")]
        {
            let delay = std::time::Duration::from_millis(2000);
            std::thread::sleep(delay);
        }
    }

    if error_occured {
        print_crash_message();
    }

    match session_exit_status {
        Some(exit_status) => std::process::exit(exit_status.code().unwrap_or(0)),
        None => std::process::exit(1),
    };
}
The main-entry-point. The leftwm-session is prepared here
leftwm/src/bin/leftwm.rs