From 9316771f64842533181cfb04a27aa9ae809cc435 Mon Sep 17 00:00:00 2001 From: Tuomas Siipola Date: Sat, 6 May 2017 08:45:23 -0700 Subject: Add window padding option Padding can be configured by using the `padding` field in the config file, like so: padding: x: 2 y: 2 which would result in a 2px padding within each side of the window. --- src/config.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index 2b46b324..62e0ba49 100644 --- a/src/config.rs +++ b/src/config.rs @@ -182,6 +182,10 @@ pub struct Config { #[serde(default)] dimensions: Dimensions, + /// Pixel padding + #[serde(default="default_padding")] + padding: Delta, + /// Pixels per inch #[serde(default)] dpi: Dpi, @@ -235,6 +239,10 @@ pub struct Config { hide_cursor_when_typing: bool, } +fn default_padding() -> Delta { + Delta { x: 2., y: 2. } +} + #[cfg(not(target_os="macos"))] static DEFAULT_ALACRITTY_CONFIG: &'static str = include_str!("../alacritty.yml"); #[cfg(target_os="macos")] @@ -280,6 +288,7 @@ impl Default for Config { visual_bell: Default::default(), env: Default::default(), hide_cursor_when_typing: Default::default(), + padding: default_padding(), } } } @@ -1008,6 +1017,10 @@ impl Config { &self.selection } + pub fn padding(&self) -> &Delta { + &self.padding + } + #[inline] pub fn draw_bold_text_with_bright_colors(&self) -> bool { self.draw_bold_text_with_bright_colors -- cgit