1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
use std::time::Duration;
use alacritty_config_derive::ConfigDeserialize;
use crate::config::Program;
use crate::term::color::Rgb;
#[derive(ConfigDeserialize, Clone, Debug, PartialEq, Eq)]
pub struct BellConfig {
/// Visual bell animation function.
pub animation: BellAnimation,
/// Command to run on bell.
pub command: Option<Program>,
/// Visual bell flash color.
pub color: Rgb,
/// Visual bell duration in milliseconds.
duration: u16,
}
impl Default for BellConfig {
fn default() -> Self {
Self {
color: Rgb { r: 255, g: 255, b: 255 },
animation: Default::default(),
command: Default::default(),
duration: Default::default(),
}
}
}
impl BellConfig {
pub fn duration(&self) -> Duration {
Duration::from_millis(self.duration as u64)
}
}
/// `VisualBellAnimations` are modeled after a subset of CSS transitions and Robert
/// Penner's Easing Functions.
#[derive(ConfigDeserialize, Clone, Copy, Debug, PartialEq, Eq)]
pub enum BellAnimation {
// CSS animation.
Ease,
// CSS animation.
EaseOut,
// Penner animation.
EaseOutSine,
// Penner animation.
EaseOutQuad,
// Penner animation.
EaseOutCubic,
// Penner animation.
EaseOutQuart,
// Penner animation.
EaseOutQuint,
// Penner animation.
EaseOutExpo,
// Penner animation.
EaseOutCirc,
// Penner animation.
Linear,
}
impl Default for BellAnimation {
fn default() -> Self {
BellAnimation::EaseOutExpo
}
}
|