Skip to content

Commit

Permalink
Log used display server on Linux/BSD
Browse files Browse the repository at this point in the history
This also fixes a bug where the welcome log message wasn't logged.
  • Loading branch information
kchibisov authored Jan 30, 2022
1 parent f6651a9 commit efae2cc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion alacritty/src/display/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::{f64, mem};
use glutin::dpi::PhysicalSize;
use glutin::event::ModifiersState;
use glutin::event_loop::EventLoopWindowTarget;
#[cfg(not(any(target_os = "macos", windows)))]
#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
use glutin::platform::unix::EventLoopWindowTargetExtUnix;
use glutin::window::CursorIcon;
use log::{debug, info};
Expand Down
11 changes: 9 additions & 2 deletions alacritty/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ use std::string::ToString;
use std::{fs, process};

use glutin::event_loop::EventLoop as GlutinEventLoop;
#[cfg(not(any(target_os = "macos", windows)))]
use glutin::platform::unix::EventLoopWindowTargetExtUnix;
use log::info;
#[cfg(windows)]
use winapi::um::wincon::{AttachConsole, FreeConsole, ATTACH_PARENT_PROCESS};
Expand Down Expand Up @@ -126,15 +128,20 @@ impl Drop for TemporaryFiles {
/// Creates a window, the terminal state, PTY, I/O event loop, input processor,
/// config change monitor, and runs the main display loop.
fn alacritty(options: Options) -> Result<(), String> {
info!("Welcome to Alacritty");

// Setup glutin event loop.
let window_event_loop = GlutinEventLoop::<Event>::with_user_event();

// Initialize the logger as soon as possible as to capture output from other subsystems.
let log_file = logging::initialize(&options, window_event_loop.create_proxy())
.expect("Unable to initialize logger");

info!("Welcome to Alacritty");

#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
info!("Running on {}", if window_event_loop.is_x11() { "X11" } else { "Wayland" });
#[cfg(not(any(feature = "x11", target_os = "macos", windows)))]
info!("Running on Wayland");

// Load configuration file.
let config = config::load(&options);
log_config_path(&config);
Expand Down

0 comments on commit efae2cc

Please sign in to comment.