aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrycja Balik <patrycjabalik@gmail.com>2018-07-15 15:10:33 +0200
committerChristian Duerr <chrisduerr@users.noreply.github.com>2018-07-15 13:10:33 +0000
commit18f6a7814a7aff8fb06d6b9a795e0f8144954d1f (patch)
tree4003b07d0d2705c74227147f871351a579021121
parent4928b0ae75aa326e8dd96e745fb701ae1ce1fce1 (diff)
downloadalacritty-18f6a7814a7aff8fb06d6b9a795e0f8144954d1f.tar.gz
alacritty-18f6a7814a7aff8fb06d6b9a795e0f8144954d1f.zip
Add config for unfocused window cursor change
-rw-r--r--alacritty.yml3
-rw-r--r--alacritty_macos.yml3
-rw-r--r--src/config.rs10
-rw-r--r--src/term/mod.rs2
4 files changed, 17 insertions, 1 deletions
diff --git a/alacritty.yml b/alacritty.yml
index 1b59434f..fcbe1d02 100644
--- a/alacritty.yml
+++ b/alacritty.yml
@@ -237,6 +237,9 @@ hide_cursor_when_typing: false
# - Beam
cursor_style: Block
+# Whether the cursor should be a hollow block on window focus loss
+unfocused_hollow_cursor: true
+
# Live config reload (changes require restart)
live_config_reload: true
diff --git a/alacritty_macos.yml b/alacritty_macos.yml
index 19590842..4469c190 100644
--- a/alacritty_macos.yml
+++ b/alacritty_macos.yml
@@ -216,6 +216,9 @@ hide_cursor_when_typing: false
# - Beam
cursor_style: Block
+# Whether the cursor should be a hollow block on window focus loss
+unfocused_hollow_cursor: true
+
# Live config reload (changes require restart)
live_config_reload: true
diff --git a/src/config.rs b/src/config.rs
index cdf1dc21..95058d38 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -390,6 +390,10 @@ pub struct Config {
#[serde(default, deserialize_with = "failure_default")]
cursor_style: CursorStyle,
+ /// Use hollow block cursor when unfocused
+ #[serde(default="true_bool", deserialize_with = "default_true_bool")]
+ unfocused_hollow_cursor: bool,
+
/// Live config reload
#[serde(default="true_bool", deserialize_with = "default_true_bool")]
live_config_reload: bool,
@@ -1363,6 +1367,12 @@ impl Config {
self.cursor_style
}
+ /// Use hollow block cursor when unfocused
+ #[inline]
+ pub fn unfocused_hollow_cursor(&self) -> bool {
+ self.unfocused_hollow_cursor
+ }
+
/// Live config reload
#[inline]
pub fn live_config_reload(&self) -> bool {
diff --git a/src/term/mod.rs b/src/term/mod.rs
index d1f48c91..02d846a4 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -998,7 +998,7 @@ impl Term {
) -> RenderableCellsIter {
let selection = selection.and_then(|s| s.to_span(self))
.map(|span| span.to_range());
- let cursor = if window_focused {
+ let cursor = if window_focused || !config.unfocused_hollow_cursor() {
self.cursor_style.unwrap_or(self.default_cursor_style)
} else {
CursorStyle::HollowBlock