Skip to content

Commit

Permalink
layout setting: Running Ignore Mouse
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKnauth committed May 28, 2024
1 parent cc188ff commit 30a3fb6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/layout/general_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ pub struct GeneralSettings {
pub separators_color: Color,
/// The text color to use for text that doesn't specify its own color.
pub text_color: Color,
/// Ignore Mouse While Running and Not In Focus
pub mouse_pass_through_while_running: bool,
}

impl Default for GeneralSettings {
Expand All @@ -73,6 +75,7 @@ impl Default for GeneralSettings {
thin_separators_color: Color::hsla(0.0, 0.0, 1.0, 0.09),
separators_color: Color::hsla(0.0, 0.0, 1.0, 0.35),
text_color: Color::hsla(0.0, 0.0, 1.0, 1.0),
mouse_pass_through_while_running: false,
}
}
}
Expand Down Expand Up @@ -173,6 +176,11 @@ impl GeneralSettings {
"The color to use for text that doesn't specify its own color.".into(),
self.text_color.into(),
),
Field::new(
"Running Ignore Mouse".into(),
"Ignore Mouse While Running and Not In Focus".into(),
self.mouse_pass_through_while_running.into(),
),
])
}

Expand Down Expand Up @@ -201,6 +209,7 @@ impl GeneralSettings {
13 => self.thin_separators_color = value.into(),
14 => self.separators_color = value.into(),
15 => self.text_color = value.into(),
16 => self.mouse_pass_through_while_running = value.into(),
_ => panic!("Unsupported Setting Index"),
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/layout/layout_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ pub struct LayoutState {
pub separators_color: Color,
/// The text color to use for text that doesn't specify its own color.
pub text_color: Color,
/// Ignore Mouse While Running and Not In Focus
pub mouse_pass_through_while_running: bool,
}

#[cfg(feature = "std")]
Expand Down
1 change: 1 addition & 0 deletions src/layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ impl Layout {
state.separators_color = settings.separators_color;
state.text_color = settings.text_color;
state.direction = settings.direction;
state.mouse_pass_through_while_running = settings.mouse_pass_through_while_running;
}

/// Calculates the layout's state based on the timer provided. You can use
Expand Down
3 changes: 3 additions & 0 deletions src/layout/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,9 @@ fn parse_general_settings(layout: &mut Layout, reader: &mut Reader<'_>) -> Resul
}),
"ImageOpacity" => percentage(reader, |v| image_opacity = v),
"ImageBlur" => percentage(reader, |v| image_blur = v),
"MousePassThroughWhileRunning" => {
parse_bool(reader, |b| settings.mouse_pass_through_while_running = b)
}
_ => end_tag(reader),
})?;

Expand Down

0 comments on commit 30a3fb6

Please sign in to comment.