Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layout setting: Running Ignore Mouse #806

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading