aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRudis Muiznieks <rmuiznieks@nextgxdx.com>2017-01-05 15:04:23 -0600
committerRudis Muiznieks <rmuiznieks@nextgxdx.com>2017-01-06 09:18:23 -0600
commitc0054d0fe291f88ac75545ab014d0b062fa5c180 (patch)
tree5f79b8f869d7abaa42ccb5f21bbc8530af6f5b46 /src
parent3c57c0388727884f9ed4e6066f1b58408ad3fed1 (diff)
downloadalacritty-c0054d0fe291f88ac75545ab014d0b062fa5c180.tar.gz
alacritty-c0054d0fe291f88ac75545ab014d0b062fa5c180.zip
Added --title argument to set window title
Diffstat (limited to 'src')
-rw-r--r--src/cli.rs5
-rw-r--r--src/display.rs2
-rw-r--r--src/window.rs9
3 files changed, 10 insertions, 6 deletions
diff --git a/src/cli.rs b/src/cli.rs
index 15bd57c5..e95114c7 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -19,6 +19,7 @@ pub struct Options {
pub ref_test: bool,
pub columns: Column,
pub lines: Line,
+ pub title: String
}
impl Default for Options {
@@ -27,6 +28,7 @@ impl Default for Options {
ref_test: false,
columns: Column(80),
lines: Line(24),
+ title: "Alacritty".to_owned()
}
}
}
@@ -48,6 +50,9 @@ impl Options {
args_iter.next()
.map(|h| h.parse().map(|h| options.lines = Line(h)));
},
+ "-t" | "--title" => {
+ args_iter.next().map(|t| options.title = t);
+ },
// ignore unexpected
_ => (),
}
diff --git a/src/display.rs b/src/display.rs
index ab6cbc07..dccbd7fe 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -139,7 +139,7 @@ impl Display {
let render_timer = config.render_timer();
// Create the window where Alacritty will be displayed
- let mut window = Window::new()?;
+ let mut window = Window::new(&options.title)?;
// get window properties for initializing the other subsytems
let size = window.inner_size_pixels()
diff --git a/src/window.rs b/src/window.rs
index edf1e7f1..b56b28a0 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -18,9 +18,6 @@ use std::ops::Deref;
use gl;
use glutin;
-/// Default title for the window
-const DEFAULT_TITLE: &'static str = "Alacritty";
-
/// Resize handling for Mac and maybe other platforms
///
/// This delegates to a statically referenced closure for convenience. The
@@ -195,11 +192,13 @@ impl Window {
/// Create a new window
///
/// This creates a window and fully initializes a window.
- pub fn new() -> Result<Window> {
+ pub fn new(
+ title: &str
+ ) -> Result<Window> {
/// Create a glutin::Window
let mut window = glutin::WindowBuilder::new()
.with_vsync()
- .with_title(DEFAULT_TITLE)
+ .with_title(title)
.build()?;
/// Set the glutin window resize callback for *this* window. The