diff options
author | Nathan Lilienthal <nathan@nixpulvis.com> | 2018-06-18 01:26:54 -0400 |
---|---|---|
committer | Christian Duerr <chrisduerr@users.noreply.github.com> | 2018-06-18 05:26:54 +0000 |
commit | f55252ec8537e68d0c98a1fac35728a2b596d328 (patch) | |
tree | 8a9f879ad803faec66d9a9b4385e4dcd8f358680 /src/window.rs | |
parent | 5ba34d4f9766a55a06ed5e3e44cc384af1b09f65 (diff) | |
download | alacritty-f55252ec8537e68d0c98a1fac35728a2b596d328.tar.gz alacritty-f55252ec8537e68d0c98a1fac35728a2b596d328.zip |
Override dynamic_title when --title is specified
Diffstat (limited to 'src/window.rs')
-rw-r--r-- | src/window.rs | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/window.rs b/src/window.rs index ef0d9269..1903360f 100644 --- a/src/window.rs +++ b/src/window.rs @@ -25,6 +25,23 @@ use MouseCursor; use cli::Options; use config::WindowConfig; +/// Default text for the window's title bar, if not overriden. +/// +/// In X11, this the default value for the `WM_NAME` property. +pub const DEFAULT_TITLE: &str = "Alacritty"; + +/// Default text for general window class, X11 specific. +/// +/// In X11, this is the default value for the `WM_CLASS` property. The +/// second value of `WM_CLASS` is **never** changed to anything but +/// the default value. +/// +/// ```ignore +/// $ xprop | grep WM_CLASS +/// WM_CLASS(STRING) = "Alacritty", "Alacritty" +/// ``` +pub const DEFAULT_CLASS: &str = "Alacritty"; + /// Window errors #[derive(Debug)] pub enum Error { @@ -205,12 +222,14 @@ impl Window { ) -> Result<Window> { let event_loop = EventsLoop::new(); + let title = options.title.as_ref().map_or(DEFAULT_TITLE, |t| t); + let class = options.class.as_ref().map_or(DEFAULT_CLASS, |c| c); let window_builder = WindowBuilder::new() - .with_title(&*options.title) + .with_title(title) .with_visibility(false) .with_transparency(true) .with_decorations(window_config.decorations()); - let window_builder = Window::platform_builder_ext(window_builder, &options.class); + let window_builder = Window::platform_builder_ext(window_builder, &class); let window = create_gl_window(window_builder.clone(), &event_loop, false) .or_else(|_| create_gl_window(window_builder, &event_loop, true))?; window.show(); |