From ec52a892342fdff6e594fe3ede5f1fe965fd20cc Mon Sep 17 00:00:00 2001 From: imgurbot12 Date: Tue, 8 Aug 2023 12:29:25 -0700 Subject: [PATCH] feat: added sway subconfig, always include default css --- rmenu/public/99-rmenu-sway.conf | 3 +++ rmenu/public/default.css | 24 ++++++++++++------------ rmenu/src/gui.rs | 3 ++- rmenu/src/main.rs | 2 +- 4 files changed, 18 insertions(+), 14 deletions(-) create mode 100644 rmenu/public/99-rmenu-sway.conf diff --git a/rmenu/public/99-rmenu-sway.conf b/rmenu/public/99-rmenu-sway.conf new file mode 100644 index 0000000..3163368 --- /dev/null +++ b/rmenu/public/99-rmenu-sway.conf @@ -0,0 +1,3 @@ +# Configure RMenu to Spawn Floating in the Center of the Screen + +for_window [app_id="rmenu"] floating enable diff --git a/rmenu/public/default.css b/rmenu/public/default.css index 656085c..d768e5c 100644 --- a/rmenu/public/default.css +++ b/rmenu/public/default.css @@ -9,20 +9,20 @@ main { justify-content: center; } -div.navbar { +.navbar { top: 0; position: fixed; overflow: hidden; min-width: 99%; } -div.results { +.results { height: 100vh; margin-top: 50px; overflow-y: auto; } -div.selected { +.selected { background-color: lightblue; } @@ -34,49 +34,49 @@ input { /* Result CSS */ -div.result, div.action { +.result, .action { display: flex; align-items: center; justify-content: left; } -div.result > div, div.action > div { +.result > div, .action > div { margin: 2px 5px; } -div.result > div.icon { +.result > .icon { width: 4%; overflow: hidden; display: flex; justify-content: center; } -div.result > div.icon > img { +.result > .icon > img { width: 100%; height: 100%; object-fit: cover; } -div.result > div.name { +.result > .name { width: 30%; } -div.result > div.comment { +.result > .comment { flex: 1; } /* Action CSS */ -div.actions { +.actions { display: none; padding-left: 5%; } -div.action-name { +.action-name { width: 50%; } -div.actions.active { +.actions.active { display: flex; flex-direction: column; justify-content: center; diff --git a/rmenu/src/gui.rs b/rmenu/src/gui.rs index 7d1d8da..d2f384e 100644 --- a/rmenu/src/gui.rs +++ b/rmenu/src/gui.rs @@ -6,7 +6,7 @@ use rmenu_plugin::Entry; use crate::config::Keybind; use crate::state::{AppState, KeyEvent}; -use crate::App; +use crate::{App, DEFAULT_CSS_CONTENT}; /// spawn and run the app on the configured platform pub fn run(app: App) { @@ -207,6 +207,7 @@ fn App<'a>(cx: Scope) -> Element { }); cx.render(rsx! { + style { DEFAULT_CSS_CONTENT } style { "{cx.props.css}" } div { // onclick: |_| focus(cx), diff --git a/rmenu/src/main.rs b/rmenu/src/main.rs index 1c73f1b..3ccbc64 100644 --- a/rmenu/src/main.rs +++ b/rmenu/src/main.rs @@ -212,7 +212,7 @@ impl Args { Ok(css) => css, Err(err) => { log::error!("failed to load css: {err:?}"); - DEFAULT_CSS_CONTENT.to_owned() + "".to_owned() } }; // load entries from configured sources