aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2019-02-06 21:06:39 +0100
committerChristian Duerr <contact@christianduerr.com>2019-02-06 21:07:44 +0100
commit0c8e583d1d35b5745dd5acbd27d0f56df4d099e3 (patch)
treef229d26769cc7cf747a75b8ffd30c8ba941e40b5
parent01849433266c4ba8f02c4cdb7ee4de54f361bfec (diff)
downloadalacritty-issue-1582.tar.gz
alacritty-issue-1582.zip
Improve constant namingissue-1582
Since `DEFAULT_TITLE` applies to both window class and title, it has been changed to `DEFAULT_NAME` to better represent what it's used for.
-rw-r--r--src/cli.rs6
-rw-r--r--src/window.rs12
2 files changed, 8 insertions, 10 deletions
diff --git a/src/cli.rs b/src/cli.rs
index 46739998..1d16b6bc 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -16,7 +16,7 @@ use clap::{Arg, App, crate_name, crate_version, crate_authors, crate_description
use crate::index::{Line, Column};
use crate::config::{Dimensions, Shell};
-use crate::window::{DEFAULT_TITLE};
+use crate::window::{DEFAULT_NAME};
use std::path::{Path, PathBuf};
use std::borrow::Cow;
@@ -87,11 +87,11 @@ impl Options {
.long("title")
.short("t")
.takes_value(true)
- .help(&format!("Defines the window title [default: {}]", DEFAULT_TITLE)))
+ .help(&format!("Defines the window title [default: {}]", DEFAULT_NAME)))
.arg(Arg::with_name("class")
.long("class")
.takes_value(true)
- .help(&format!("Defines window class on X11 [default: {}]", DEFAULT_TITLE)))
+ .help(&format!("Defines window class on X11 [default: {}]", DEFAULT_NAME)))
.arg(Arg::with_name("q")
.short("q")
.multiple(true)
diff --git a/src/window.rs b/src/window.rs
index 914f6070..cdc3bdc7 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -33,10 +33,8 @@ use crate::MouseCursor;
#[cfg(windows)]
static WINDOW_ICON: &'static [u8] = include_bytes!("../assets/windows/alacritty.ico");
-/// 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 Alacritty name, used for window title and class.
+pub const DEFAULT_NAME: &str = "Alacritty";
/// Window errors
#[derive(Debug)]
@@ -136,8 +134,8 @@ impl Window {
pub fn new(options: &Options, window_config: &WindowConfig) -> 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_TITLE, |c| c);
+ let title = options.title.as_ref().map_or(DEFAULT_NAME, |t| t);
+ let class = options.class.as_ref().map_or(DEFAULT_NAME, |c| c);
let window_builder = Window::get_platform_window(title, class, window_config);
let window = create_gl_window(window_builder.clone(), &event_loop, false)
.or_else(|_| create_gl_window(window_builder, &event_loop, true))?;
@@ -269,7 +267,7 @@ impl Window {
.with_maximized(window_config.start_maximized())
.with_decorations(decorations)
// X11
- .with_class(class.into(), DEFAULT_TITLE.into())
+ .with_class(class.into(), DEFAULT_NAME.into())
// Wayland
.with_app_id(class.into())
}