Skip to content

Commit

Permalink
Add option for launching Alacritty maximized
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Dahan authored and chrisduerr committed Nov 19, 2018
1 parent fc04bc1 commit 2ede659
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Option for evenly spreading extra padding around the terminal (`window.dynamic_padding`)
- Option for maximizing alacritty on start (`window.start_maximized`)
- Display notice about errors and warnings inside Alacritty
- Log all messages to both stderr and a log file in the system's temporary directory
- New configuration option `persistent_logging` and CLI flag `--persistent-logging`,
Expand Down
3 changes: 3 additions & 0 deletions alacritty.yml
Expand Up @@ -39,6 +39,9 @@ window:
# - none: Neither borders nor title bar
decorations: full

# When true, alacritty starts maximized.
start_maximized: false

scrolling:
# Maximum number of lines in the scrollback buffer.
# Specifying '0' will disable scrolling.
Expand Down
3 changes: 3 additions & 0 deletions alacritty_macos.yml
Expand Up @@ -50,6 +50,9 @@ window:
# - transparent: Title bar, transparent background, but no title bar buttons
decorations: full

# When true, alacritty starts maximized.
start_maximized: false

scrolling:
# Maximum number of lines in the scrollback buffer.
# Specifying '0' will disable scrolling.
Expand Down
3 changes: 3 additions & 0 deletions alacritty_windows.yml
Expand Up @@ -39,6 +39,9 @@ window:
# - none: Neither borders nor title bar
decorations: full

# When true, alacritty starts maximized.
start_maximized: false

scrolling:
# Maximum number of lines in the scrollback buffer.
# Specifying '0' will disable scrolling.
Expand Down
9 changes: 9 additions & 0 deletions src/config.rs
Expand Up @@ -380,6 +380,10 @@ pub struct WindowConfig {
/// Spread out additional padding evenly
#[serde(default, deserialize_with = "failure_default")]
dynamic_padding: bool,

/// Start maximized
#[serde(default, deserialize_with = "failure_default")]
start_maximized: bool,
}

fn default_padding() -> Delta<u8> {
Expand All @@ -406,6 +410,10 @@ impl WindowConfig {
pub fn dynamic_padding(&self) -> bool {
self.dynamic_padding
}

pub fn start_maximized(&self) -> bool {
self.start_maximized
}
}

impl Default for WindowConfig {
Expand All @@ -415,6 +423,7 @@ impl Default for WindowConfig {
padding: default_padding(),
decorations: Default::default(),
dynamic_padding: false,
start_maximized: false,
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/window.rs
Expand Up @@ -300,6 +300,7 @@ impl Window {
.with_title(title)
.with_visibility(false)
.with_transparency(true)
.with_maximized(window_config.start_maximized())
.with_decorations(decorations)
}

Expand All @@ -317,6 +318,7 @@ impl Window {
.with_visibility(cfg!(windows))
.with_decorations(decorations)
.with_transparency(true)
.with_maximized(window_config.start_maximized())
.with_window_icon(Some(icon))
}

Expand All @@ -327,7 +329,8 @@ impl Window {
let window = WindowBuilder::new()
.with_title(title)
.with_visibility(false)
.with_transparency(true);
.with_transparency(true)
.with_maximized(window_config.start_maximized());

match window_config.decorations() {
Decorations::Full => window,
Expand Down

0 comments on commit 2ede659

Please sign in to comment.