summaryrefslogtreecommitdiff
path: root/src/window.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.rs')
-rw-r--r--src/window.rs23
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();