diff --git a/examples/worf-warden/src/main.rs b/examples/worf-warden/src/main.rs index 623474f..382853b 100644 --- a/examples/worf-warden/src/main.rs +++ b/examples/worf-warden/src/main.rs @@ -355,7 +355,7 @@ fn main() -> Result<(), String> { // will exit if there is a daemon running already, so it's fine to call this everytime. if let Err(e) = spawn_fork("ydotoold", None) { - log::error!("Failed to start ydotool daemon: {e}"); + log::error!("Failed to start ydotool daemon: {e}"); } // todo eventually use a propper rust client for this, for now rbw is good enough diff --git a/styles/compact/style.css b/styles/compact/style.css index 83d3a16..6077469 100644 --- a/styles/compact/style.css +++ b/styles/compact/style.css @@ -1,6 +1,10 @@ * { -font-family: DejaVu; - transition: opacity 500ms ease; + font-family: DejaVu; + transition: opacity 500ms ease; +} + +#background { + background-color: rgba(33, 33, 33, 0.1); } #window { diff --git a/styles/emoji/style.css b/styles/emoji/style.css index 115dce8..62d7f22 100644 --- a/styles/emoji/style.css +++ b/styles/emoji/style.css @@ -2,6 +2,10 @@ font-family: DejaVu; } +#background { + background-color: rgba(33, 33, 33, 0.1); +} + #window { all: unset; background-color: rgba(33, 33, 33, 0.8); /* Matches #212121BB */ diff --git a/styles/launcher/config.toml b/styles/launcher/config.toml index 4643c41..9086a0d 100644 --- a/styles/launcher/config.toml +++ b/styles/launcher/config.toml @@ -6,5 +6,5 @@ content_halign="Center" height="70%" width="60%" valign="Start" -#line_wrap="Word" +blurred_background=true line_max_chars=32 diff --git a/styles/launcher/style.css b/styles/launcher/style.css index 0c4d46d..4ad617f 100644 --- a/styles/launcher/style.css +++ b/styles/launcher/style.css @@ -2,6 +2,10 @@ font-family: DejaVu; } +#background { + background-color: rgba(33, 33, 33, 0.1); +} + #window { all: unset; background-color: rgba(33, 33, 33, 0.8); /* Matches #212121BB */ diff --git a/styles/math/config.toml b/styles/math/config.toml new file mode 100644 index 0000000..7fb1c7b --- /dev/null +++ b/styles/math/config.toml @@ -0,0 +1,8 @@ +image_size=28 +allow_images=false +term="kitty -e" +insensitive=true +key_detection_type="Code" +blurred_background=false +location=["Top"] +lines=3 diff --git a/styles/math/style.css b/styles/math/style.css new file mode 100644 index 0000000..a113558 --- /dev/null +++ b/styles/math/style.css @@ -0,0 +1,86 @@ +* { +font-family: DejaVu; + transition: opacity 500ms ease; +} + +#background { + background-color: rgba(33, 33, 33, 0.1); +} + +#window { + all: unset; + background-color: rgba(33, 33, 33, 0.8); /* Matches #212121BB */ + border-radius: 0px; +} + +#window #outer-box { + /* The name of the search bar */ + /* The name of the scrolled window containing all of the entries */ + border: 2px solid rgba(63, 81, 181, 1); + border-radius: 6px; +} + +#window #outer-box #input { + background-color: rgba(32, 32, 32, 0.6); + color: #f2f2f2; + border-bottom: 2px solid rgba(214, 174, 0, 1); + padding: 0.8rem 1rem; + font-size: 1rem; +} + +#window #outer-box #input:focus, #window #outer-box #input:focus-visible, #window #outer-box #input:active { + all: unset; + background-color: rgba(32, 32, 32, 0.6); + color: #f2f2f2; + border-bottom: 2px solid rgba(214, 174, 2, 1); + padding: 1.2rem; + padding-left: 1rem; + font-size: 1rem; +} + +#window #outer-box #scroll { + border-top: 2px solid rgba(214, 174, 0, 1); +} +#window #outer-box #scroll #inner-box { + /* The name of all entries */ + /* The name of all boxes shown when expanding */ + /* entries with multiple actions */ +} +#window #outer-box #scroll #inner-box #entry { + color: #fff; + background-color: rgba(32, 32, 32, 0.1); + padding: 0.6rem 1rem; + /* The name of all images in entries displayed in image mode */ + /* The name of all the text in entries */ +} +#window #outer-box #scroll #inner-box #entry #img { + margin-right: 0.5rem; +} +#window #outer-box #scroll #inner-box #entry:selected { + color: #fff; + background-color: rgba(255, 255, 255, 0.1); + outline: none; +} + +#row:hover { + background-color: rgba(255, 255, 255, 0); + outline: inherit; + outline-color: inherit; +} +#window #outer-box #scroll #inner-box #entry:hover { + background-color: rgba(255, 255, 255, 0.1); + outline: inherit; + outline-color: inherit; +} + +#custom-key-label-box { + margin-top: 0.25em; + margin-bottom: 0.25em; + border-right: 1px solid rgba(214, 174, 0, 1); + border-left: 1px solid rgba(214, 174, 0, 1); + padding-left: 1em; +} + +#custom-key-hint-text { + margin-left: 0.75em; +} diff --git a/styles/relaxed/style.css b/styles/relaxed/style.css index 0c4d46d..4ad617f 100644 --- a/styles/relaxed/style.css +++ b/styles/relaxed/style.css @@ -2,6 +2,10 @@ font-family: DejaVu; } +#background { + background-color: rgba(33, 33, 33, 0.1); +} + #window { all: unset; background-color: rgba(33, 33, 33, 0.8); /* Matches #212121BB */ diff --git a/worf/src/lib/config.rs b/worf/src/lib/config.rs index 2d0bb19..4493896 100644 --- a/worf/src/lib/config.rs +++ b/worf/src/lib/config.rs @@ -421,6 +421,11 @@ pub struct Config { /// Defaults to `` #[clap(long = "search-query")] search_query: Option, + + /// Blur the background of the screen + /// can be style via `background` + #[clap(long = "blurred-background")] + blurred_background: Option, } impl Config { @@ -663,6 +668,11 @@ impl Config { .clone() .unwrap_or_else(|| "https://duckduckgo.com/?q=".to_owned()) } + + #[must_use] + pub fn blurred_background(&self) -> bool { + self.blurred_background.unwrap_or(false) + } } fn default_false() -> bool { diff --git a/worf/src/lib/gui.rs b/worf/src/lib/gui.rs index 71fa76f..06ebf0c 100644 --- a/worf/src/lib/gui.rs +++ b/worf/src/lib/gui.rs @@ -680,8 +680,6 @@ fn build_ui( log::debug!("keyboard ready after {:?}", start.elapsed()); - ui_elements.window.set_widget_name("window"); - if !config.normal_window() { // Initialize the window as a layer ui_elements.window.init_layer_shell(); @@ -689,9 +687,11 @@ fn build_ui( ui_elements .window .set_keyboard_mode(KeyboardMode::Exclusive); - ui_elements.window.set_namespace(Some("worf")); } + ui_elements.window.set_widget_name("window"); + ui_elements.window.set_namespace(Some("worf")); + if let Some(location) = config.location() { for anchor in location { ui_elements.window.set_anchor(anchor.into(), true); @@ -742,6 +742,21 @@ fn build_ui( let window_start = Instant::now(); ui_elements.window.present(); + if config.blurred_background() { + let background = ApplicationWindow::builder() + .decorated(false) + .resizable(false) + .fullscreened(true) + // arbitrary huge window so it fills the whole screen + .default_width(100_000) + .default_height(100_000) + .build(); + background.set_widget_name("background"); + background.set_namespace(Some("worf")); + + background.present(); + } + log::debug!("window show took {:?}", window_start.elapsed()); log::debug!("Building UI took {:?}", start.elapsed(),);