1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-18 13:55:23 -05:00

Improve constant naming

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.
This commit is contained in:
Christian Duerr 2019-02-06 21:06:39 +01:00
parent 0184943326
commit 0c8e583d1d
No known key found for this signature in database
GPG key ID: 85CDAE3C164BA7B4
2 changed files with 8 additions and 10 deletions

View file

@ -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)

View file

@ -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())
}