diff options
author | Kirill Chibisov <wchibisovkirill@gmail.com> | 2019-04-28 21:12:36 +0300 |
---|---|---|
committer | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-04-28 18:12:35 +0000 |
commit | 37b66a7cd2e53fae93e3c2c8bc3ddbd9cbe140d2 (patch) | |
tree | 0ab607f2cb3701825067f4c7f6f0e3a85dd2eede /alacritty_terminal/src/window.rs | |
parent | b321406908a83f072594f8c2b455c3aefc121750 (diff) | |
download | alacritty-37b66a7cd2e53fae93e3c2c8bc3ddbd9cbe140d2.tar.gz alacritty-37b66a7cd2e53fae93e3c2c8bc3ddbd9cbe140d2.zip |
Set _NET_WM_ICON on X11
Diffstat (limited to 'alacritty_terminal/src/window.rs')
-rw-r--r-- | alacritty_terminal/src/window.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/alacritty_terminal/src/window.rs b/alacritty_terminal/src/window.rs index 89e455dc..a929a1b7 100644 --- a/alacritty_terminal/src/window.rs +++ b/alacritty_terminal/src/window.rs @@ -18,19 +18,20 @@ use crate::gl; use glutin::dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize}; #[cfg(not(any(target_os = "macos", windows)))] use glutin::os::unix::EventsLoopExt; -#[cfg(windows)] +#[cfg(not(target_os = "macos"))] use glutin::Icon; use glutin::{ self, ContextBuilder, ControlFlow, Event, EventsLoop, MouseCursor, PossiblyCurrent, WindowBuilder, }; -#[cfg(windows)] +#[cfg(not(target_os = "macos"))] use image::ImageFormat; use crate::cli::Options; use crate::config::{Decorations, StartupMode, WindowConfig}; -#[cfg(windows)] +// It's required to be in this directory due to the `windows.rc` file +#[cfg(not(target_os = "macos"))] static WINDOW_ICON: &'static [u8] = include_bytes!("../../extra/windows/alacritty.ico"); /// Default Alacritty name, used for window title and class. @@ -288,12 +289,15 @@ impl Window { _ => true, }; + let icon = Icon::from_bytes_with_format(WINDOW_ICON, ImageFormat::ICO); + WindowBuilder::new() .with_title(title) .with_visibility(false) .with_transparency(true) .with_decorations(decorations) .with_maximized(window_config.startup_mode() == StartupMode::Maximized) + .with_window_icon(icon.ok()) // X11 .with_class(class.into(), DEFAULT_NAME.into()) // Wayland @@ -306,20 +310,20 @@ impl Window { _class: &str, window_config: &WindowConfig, ) -> WindowBuilder { - let icon = Icon::from_bytes_with_format(WINDOW_ICON, ImageFormat::ICO).unwrap(); - let decorations = match window_config.decorations() { Decorations::None => false, _ => true, }; + let icon = Icon::from_bytes_with_format(WINDOW_ICON, ImageFormat::ICO); + WindowBuilder::new() .with_title(title) .with_visibility(cfg!(windows)) .with_decorations(decorations) .with_transparency(true) .with_maximized(window_config.startup_mode() == StartupMode::Maximized) - .with_window_icon(Some(icon)) + .with_window_icon(icon.ok()) } #[cfg(target_os = "macos")] |