From 6c1dfe191843ad56aaa0381e5645ad9e74c38b8b Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Fri, 17 Jan 2025 23:01:00 +0200 Subject: Accumulate config engine, build metadata, and doc updates Remaining files from the backlog: Lua config engine additions (general/register/support/window), workspace Cargo.toml/ Cargo.lock churn from the new dependencies added elsewhere in this sweep, srdwm/main.rs wiring, and docs (DEFAULTS.md plus a new SESSION_HANDOFF.md written mid-session for continuity across a restart - see that file's own header for what it is and isn't). --- crates/config/src/engine/general.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'crates/config/src/engine/general.rs') diff --git a/crates/config/src/engine/general.rs b/crates/config/src/engine/general.rs index 96ea4d3..98cfebe 100644 --- a/crates/config/src/engine/general.rs +++ b/crates/config/src/engine/general.rs @@ -128,7 +128,8 @@ impl Engine { /// class_regex = "...", instance = "..." }, { floating = true, /// workspace = 2, x = .., y = .., width = .., height = .., /// decorated = false, border_color = {r,g,b}, border_width = 2, - /// maximized = true, opacity = 0.9 })`. At least one matcher field is + /// corner_radius = 10, maximized = true, opacity = 0.9 })`. At least + /// one matcher field is /// required; unmatched rules apply nothing. /// /// `title`/`class` are plain substring/exact match, cheap and cover @@ -182,6 +183,7 @@ impl Engine { decorated: actions.get("decorated")?, border_color, border_width: actions.get("border_width")?, + corner_radius: actions.get("corner_radius")?, pinned: actions.get("pinned")?, opacity: actions.get("opacity")?, resize_margin: actions.get("resize_margin")?, @@ -217,6 +219,22 @@ impl Engine { })?) } + /// Sets an environment variable in srdwm's own process - `std::process:: + /// Command` inherits the parent's environment by default (`fn_spawn` + /// above never overrides that), so anything set here is visible to + /// every process `srd.spawn` starts from this point on, and to their own + /// children in turn. Hyprland's `env = NAME,VALUE` works the same way + /// (sets it in its own process before forking anything), which is the + /// mechanism a ported `env.conf` needs - there is no per-spawn + /// equivalent that would let one client see a variable no other client + /// does, so this is deliberately global and process-wide, not scoped. + pub(super) fn fn_setenv(&self) -> Result> { + Ok(self.lua.create_function(move |_, (name, value): (String, String)| { + std::env::set_var(&name, &value); + Ok(()) + })?) + } + pub(super) fn fn_quit(&self) -> Result> { let state = self.state.clone(); Ok(self.lua.create_function(move |_, ()| { -- cgit v1.2.3