diff options
author | Brian Koropoff <bkoropoff@gmail.com> | 2019-07-06 12:34:56 -0700 |
---|---|---|
committer | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-07-06 19:34:56 +0000 |
commit | 228c641769c39bcd1460959e479b2259e7d5f773 (patch) | |
tree | f7bece352f9063753aa5af834bcb31eeecb82914 /alacritty_terminal/src/window.rs | |
parent | e398eb84064c5eac7cb8a97c276494100a37314b (diff) | |
download | alacritty-228c641769c39bcd1460959e479b2259e7d5f773.tar.gz alacritty-228c641769c39bcd1460959e479b2259e7d5f773.zip |
Allow setting gtk variant and general class on X11
Diffstat (limited to 'alacritty_terminal/src/window.rs')
-rw-r--r-- | alacritty_terminal/src/window.rs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/alacritty_terminal/src/window.rs b/alacritty_terminal/src/window.rs index f7eb16c1..204a1f73 100644 --- a/alacritty_terminal/src/window.rs +++ b/alacritty_terminal/src/window.rs @@ -151,9 +151,8 @@ impl Window { dimensions: Option<LogicalSize>, ) -> Result<Window> { let title = config.window.title.as_ref().map_or(DEFAULT_NAME, |t| t); - let class = config.window.class.as_ref().map_or(DEFAULT_NAME, |c| c); - let window_builder = Window::get_platform_window(title, class, &config.window); + let window_builder = Window::get_platform_window(title, &config.window); let windowed_context = create_gl_window(window_builder.clone(), &event_loop, false, dimensions) .or_else(|_| create_gl_window(window_builder, &event_loop, true, dimensions))?; @@ -255,7 +254,6 @@ impl Window { #[cfg(not(any(target_os = "macos", windows)))] pub fn get_platform_window( title: &str, - class: &str, window_config: &WindowConfig, ) -> WindowBuilder { use glutin::os::unix::WindowBuilderExt; @@ -267,7 +265,9 @@ impl Window { let icon = Icon::from_bytes_with_format(WINDOW_ICON, ImageFormat::ICO); - WindowBuilder::new() + let class = &window_config.class; + + let mut builder = WindowBuilder::new() .with_title(title) .with_visibility(false) .with_transparency(true) @@ -275,15 +275,20 @@ impl Window { .with_maximized(window_config.startup_mode() == StartupMode::Maximized) .with_window_icon(icon.ok()) // X11 - .with_class(class.into(), DEFAULT_NAME.into()) + .with_class(class.instance.clone(), class.general.clone()) // Wayland - .with_app_id(class.into()) + .with_app_id(class.instance.clone()); + + if let Some(ref val) = window_config.gtk_theme_variant { + builder = builder.with_gtk_theme_variant(val.clone()) + } + + builder } #[cfg(windows)] pub fn get_platform_window( title: &str, - _class: &str, window_config: &WindowConfig, ) -> WindowBuilder { let decorations = match window_config.decorations { @@ -305,7 +310,6 @@ impl Window { #[cfg(target_os = "macos")] pub fn get_platform_window( title: &str, - _class: &str, window_config: &WindowConfig, ) -> WindowBuilder { use glutin::os::macos::WindowBuilderExt; |