mod auto_hide;
mod general;
mod poll_intervals;
mod styling;
mod widget_options;
mod widgets;
use super::SettingsUI;
use super::section::section_matches;
use std::collections::HashSet;
pub fn show(
ui: &mut egui::Ui,
settings: &mut SettingsUI,
changes_this_frame: &mut bool,
collapsed: &mut HashSet<String>,
) {
let query = settings.search_query.trim().to_lowercase();
if section_matches(
&query,
"General",
&["enable", "status bar", "position", "height"],
) {
general::show_general_section(ui, settings, changes_this_frame, collapsed);
}
if section_matches(
&query,
"Styling",
&[
"color",
"background",
"foreground",
"font",
"separator",
"opacity",
],
) {
styling::show_styling_section(ui, settings, changes_this_frame, collapsed);
}
if section_matches(
&query,
"Auto-Hide",
&["auto hide", "fullscreen", "mouse", "inactivity", "timeout"],
) {
auto_hide::show_auto_hide_section(ui, settings, changes_this_frame, collapsed);
}
if section_matches(
&query,
"Widget Options",
&[
"time", "format", "clock", "git", "ahead", "behind", "dirty", "status",
],
) {
widget_options::show_widget_options_section(ui, settings, changes_this_frame, collapsed);
}
if section_matches(
&query,
"Poll Intervals",
&["poll", "interval", "system", "git", "refresh"],
) {
poll_intervals::show_poll_intervals_section(ui, settings, changes_this_frame, collapsed);
}
if section_matches(
&query,
"Widgets",
&[
"widget",
"clock",
"cpu",
"memory",
"network",
"git",
"bell",
"command",
"directory",
"hostname",
"left",
"center",
"right",
"custom",
"update",
],
) {
widgets::show_widgets_section(ui, settings, changes_this_frame, collapsed);
}
}
pub fn keywords() -> &'static [&'static str] {
&[
"status",
"status bar",
"widget",
"widgets",
"cpu",
"memory",
"network",
"git branch",
"git status",
"ahead",
"behind",
"dirty",
"clock",
"time",
"time format",
"hostname",
"username",
"auto hide",
"poll interval",
"separator",
"bell indicator",
"current command",
"directory",
"section",
"left",
"center",
"right",
"position",
"height",
"background",
"background color",
"background opacity",
"text color",
"foreground",
"font size",
"fullscreen",
"inactivity",
"inactivity timeout",
"custom text",
"custom widget",
"strftime",
]
}