diff options
author | Tezkerek <andrei.ancuta@gmail.com> | 2018-06-07 19:53:16 +0300 |
---|---|---|
committer | Christian Duerr <chrisduerr@users.noreply.github.com> | 2018-06-07 16:53:16 +0000 |
commit | 66acf1e03da4d0206e3368bf58953b071887ccb2 (patch) | |
tree | bcdff68e708c02c75df6ffc0545d2fb5d13389d3 /src/window.rs | |
parent | 93780ef0929e08f3c5212e5451152ecaf1a28813 (diff) | |
download | alacritty-66acf1e03da4d0206e3368bf58953b071887ccb2.tar.gz alacritty-66acf1e03da4d0206e3368bf58953b071887ccb2.zip |
Add working --class and --title CLI parameters
Diffstat (limited to 'src/window.rs')
-rw-r--r-- | src/window.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/window.rs b/src/window.rs index 987332e0..ef0d9269 100644 --- a/src/window.rs +++ b/src/window.rs @@ -22,6 +22,7 @@ use glutin::GlContext; use MouseCursor; +use cli::Options; use config::WindowConfig; /// Window errors @@ -199,17 +200,17 @@ impl Window { /// /// This creates a window and fully initializes a window. pub fn new( - title: &str, + options: &Options, window_config: &WindowConfig, ) -> Result<Window> { let event_loop = EventsLoop::new(); let window_builder = WindowBuilder::new() - .with_title(title) + .with_title(&*options.title) .with_visibility(false) .with_transparency(true) .with_decorations(window_config.decorations()); - let window_builder = Window::platform_builder_ext(window_builder); + let window_builder = Window::platform_builder_ext(window_builder, &options.class); let window = create_gl_window(window_builder.clone(), &event_loop, false) .or_else(|_| create_gl_window(window_builder, &event_loop, true))?; window.show(); @@ -322,13 +323,13 @@ impl Window { } #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd"))] - fn platform_builder_ext(window_builder: WindowBuilder) -> WindowBuilder { + fn platform_builder_ext(window_builder: WindowBuilder, wm_class: &str) -> WindowBuilder { use glutin::os::unix::WindowBuilderExt; - window_builder.with_class("alacritty".to_owned(), "Alacritty".to_owned()) + window_builder.with_class(wm_class.to_owned(), "Alacritty".to_owned()) } #[cfg(not(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd")))] - fn platform_builder_ext(window_builder: WindowBuilder) -> WindowBuilder { + fn platform_builder_ext(window_builder: WindowBuilder, _: &str) -> WindowBuilder { window_builder } |