srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/config/src/engine/general.rs
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2025-02-15 14:56:00 +0200
committersrdusr <[email protected]>2025-02-15 14:56:00 +0200
commit0a4c4b5941fe982ccb3d3175e26d9d83f0025ffd (patch)
tree7672d0af277664f457c6c9462925c0005fe35dcf /crates/config/src/engine/general.rs
parent413daa7ba2ea0ebd1424c024fd0566423aaea3f8 (diff)
downloadsrdwm-0a4c4b5941fe982ccb3d3175e26d9d83f0025ffd.tar.gz
srdwm-0a4c4b5941fe982ccb3d3175e26d9d83f0025ffd.zip
Checkpoint: preserve all uncommitted rust-rewrite worktree work
Safety commit before reconciling this worktree with main, which has diverged with its own separate fixes today. Nothing here is reviewed or curated yet - this exists purely so none of this work can be lost to a git operation, disk issue, or worktree cleanup while that reconciliation happens.
Diffstat (limited to 'crates/config/src/engine/general.rs')
-rw-r--r--crates/config/src/engine/general.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/crates/config/src/engine/general.rs b/crates/config/src/engine/general.rs
index 98cfebe..94b029b 100644
--- a/crates/config/src/engine/general.rs
+++ b/crates/config/src/engine/general.rs
@@ -194,6 +194,41 @@ impl Engine {
})?)
}
+ /// `srd.monitor.split(name, parts[, direction])` - divides connector
+ /// `name`'s real output into `parts` equal logical monitors for
+ /// placement/tiling purposes ("monitors inside monitors"), no new
+ /// `wl_output` involved - see `srdwm_core::monitor::MonitorSplit`'s
+ /// own doc comment for exactly what that does and doesn't give a
+ /// client. `direction` is `"columns"` (default, side-by-side) or
+ /// `"rows"` (stacked); any other value is treated as `"columns"`
+ /// rather than erroring, same "malformed value falls back to a
+ /// sensible default" stance other config setters already take.
+ /// `parts <= 1` clears an existing split for `name`.
+ pub(super) fn fn_monitor_split(&self) -> Result<mlua::Function<'_>> {
+ let state = self.state.clone();
+ Ok(self.lua.create_function(move |_, (name, parts, direction): (String, u32, Option<String>)| {
+ let rows = matches!(direction.as_deref(), Some("rows"));
+ state.borrow().wm.borrow_mut().set_monitor_split(name, parts, rows);
+ Ok(())
+ })?)
+ }
+
+ /// `srd.monitor.scale(name, factor)` - sets connector `name`'s
+ /// output scale, applied the next time a backend brings that head up
+ /// (startup, hotplug, or re-enable). A physically large monitor with
+ /// the same pixel count as a smaller one (a big low-DPI external
+ /// display next to a small high-DPI laptop panel, say) can run below
+ /// `1.0` to show more logical desktop space rather than just larger
+ /// text at the same resolution. `factor <= 0` clears an existing
+ /// override.
+ pub(super) fn fn_monitor_scale(&self) -> Result<mlua::Function<'_>> {
+ let state = self.state.clone();
+ Ok(self.lua.create_function(move |_, (name, factor): (String, f64)| {
+ state.borrow().wm.borrow_mut().set_monitor_scale(name, factor);
+ Ok(())
+ })?)
+ }
+
pub(super) fn fn_load(&self) -> Result<mlua::Function<'_>> {
let state = self.state.clone();
Ok(self.lua.create_function(move |lua, module: String| {