Unrotate dell monitor to reflect new physical reality.

Had some quirks with latest i3 + nvidia drivers, so unrotate for now.
This commit is contained in:
Bill Thiede 2021-05-20 18:18:42 -07:00
parent da10975070
commit 2e9f3f2ea0
4 changed files with 51 additions and 65 deletions

1
.envrc
View File

@ -1 +0,0 @@
use_nix

View File

@ -1,19 +0,0 @@
let
unstableTarball = fetchTarball
"https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz";
pkgs = import <nixpkgs> { };
unstable = import unstableTarball { };
in with pkgs;
pkgs.mkShell {
name = "rust";
buildInputs = [
openssl
pkg-config
unstable.cargo
unstable.rustc
unstable.rustfmt
unstable.rust-analyzer
postgresql
];
}

View File

@ -51,8 +51,8 @@ pub struct Resolution {
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct Offset { pub struct Offset {
pub x: usize, pub x: isize,
pub y: usize, pub y: isize,
} }
pub enum Orientation { pub enum Orientation {
@ -106,7 +106,7 @@ impl Screen {
None => return Err(CommandError::MissingMonitor(self.name.to_string())), None => return Err(CommandError::MissingMonitor(self.name.to_string())),
}; };
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}}}", 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, connection=connection,
w=width, w=width,
h=height, h=height,
@ -167,6 +167,7 @@ mod tests {
width: 1920, width: 1920,
height: 1200, height: 1200,
}, },
offset: Offset { x: 0, y: 0 },
orientation: Orientation::Right, orientation: Orientation::Right,
..Default::default() ..Default::default()
}, },

View File

@ -3,36 +3,41 @@ use anyhow::Result;
use fixscreen::*; use fixscreen::*;
fn main() -> Result<()> { fn main() -> Result<()> {
let cfg = Config { let dell = Screen {
screens: vec![
Screen {
name: ("DELL U2415".to_string()), name: ("DELL U2415".to_string()),
resolution: Resolution { resolution: Resolution {
width: 1920, width: 1920,
height: 1200, height: 1200,
}, },
orientation: Orientation::Left, offset: Offset { x: 0, y: 360 },
..Default::default() ..Default::default()
}, };
Screen { let lg = Screen {
name: ("LG Electronics 34UM95".to_string()), name: ("LG Electronics 34UM95".to_string()),
resolution: Resolution { resolution: Resolution {
width: 3440, width: 3440,
height: 1440, height: 1440,
}, },
offset: Offset { x: 1200, y: 0 }, offset: Offset {
..Default::default() x: dell.resolution.width as isize,
y: 0,
}, },
Screen { ..Default::default()
};
let lenovo = Screen {
name: ("Lenovo Group Limited P27h-20".to_string()), name: ("Lenovo Group Limited P27h-20".to_string()),
resolution: Resolution { resolution: Resolution {
width: 2560, width: 2560,
height: 1440, height: 1440,
}, },
offset: Offset { x: 4640, y: 0 }, offset: Offset {
..Default::default() x: (dell.resolution.width + lg.resolution.width) as isize,
y: 0,
}, },
], ..Default::default()
};
let cfg = Config {
screens: vec![dell, lg, lenovo],
}; };
let map = screen_mapping_from_xorg_log("/var/log/X.0.log")?; let map = screen_mapping_from_xorg_log("/var/log/X.0.log")?;