mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-18 13:55:23 -05:00
Add config for unfocused window cursor change
This commit is contained in:
parent
4928b0ae75
commit
18f6a7814a
4 changed files with 17 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue