Compare commits

..

3 Commits

2 changed files with 26 additions and 10 deletions

View File

@ -1,9 +1,11 @@
use std::collections::HashMap;
use std::fmt;
use std::fs::File;
use std::io::{self, BufRead, BufReader};
use std::path::Path;
use std::process::{Command, Output};
use std::{
collections::HashMap,
fmt,
fs::File,
io::{self, BufRead, BufReader},
path::Path,
process::{Command, Output},
};
use regex::Regex;
use thiserror::Error;
@ -90,7 +92,7 @@ impl Screen {
fn metamode(&self, map: &ScreenMapping) -> Result<String, CommandError> {
let Resolution { width, height } = self.resolution;
let Offset { x, y } = self.offset;
let (in_w, in_h) = match self.orientation {
let (_in_w, _in_h) = match self.orientation {
Orientation::None | Orientation::Invert => (width, height),
Orientation::Right | Orientation::Left => (height, width),
};
@ -106,6 +108,16 @@ impl Screen {
None => return Err(CommandError::MissingMonitor(self.name.to_string())),
};
Ok(format!(
"{connection}: {w}x{h} {x:+}{y:+} {{ForceCompositionPipeline=On, Rotation={rotation}}}",
connection = connection,
w = width,
h = height,
x = x,
y = y,
rotation = rotation,
))
/*
Ok(format!("{connection}: {w}x{h} @{in_w}x{in_h} {x:+}{y:+} {{ForceCompositionPipeline=On, ViewPortIn={in_w}x{in_h}, ViewPortOut={w}x{h}+0+0, Rotation={rotation}}}",
connection=connection,
w=width,
@ -116,6 +128,7 @@ impl Screen {
y=y,
rotation=rotation,
))
*/
}
}

View File

@ -22,7 +22,11 @@ fn main() -> Result<()> {
height: 1440,
},
offset: Offset {
x: dell.resolution.height as isize,
// The '1 +' here creates a gap between the top monitor and side monitor. When all
// monitors have a gap, you can move the mouse between any combo. When the top monitor
// is flush with the left, the bottom monitor will have a hard edge that prevents the
// mouse from moving to the left monitor.
x: 1 + dell.resolution.height as isize,
y: 0,
},
..Default::default()
@ -34,8 +38,7 @@ fn main() -> Result<()> {
height: 1440,
},
offset: Offset {
x: dell.resolution.height as isize,
//x: (dell.resolution.height + (lg.resolution.width - 2560) / 2) as isize,
x: (dell.resolution.height + (lg.resolution.width - 2560) / 2) as isize,
y: (lg.resolution.height) as isize,
},
..Default::default()