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:
parent
da10975070
commit
2e9f3f2ea0
19
default.nix
19
default.nix
@ -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
|
|
||||||
];
|
|
||||||
}
|
|
||||||
33
src/lib.rs
33
src/lib.rs
@ -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,16 +106,16 @@ 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,
|
||||||
in_w=in_w,
|
in_w=in_w,
|
||||||
in_h=in_h,
|
in_h=in_h,
|
||||||
x=x,
|
x=x,
|
||||||
y=y,
|
y=y,
|
||||||
rotation=rotation,
|
rotation=rotation,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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()
|
||||||
},
|
},
|
||||||
@ -201,14 +202,14 @@ mod tests {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
build_cmd_args(&map, cfg).expect("failed build_cmd_args"),
|
build_cmd_args(&map, cfg).expect("failed build_cmd_args"),
|
||||||
vec![
|
vec![
|
||||||
"nvidia-settings",
|
"nvidia-settings",
|
||||||
"--assign",
|
"--assign",
|
||||||
"CurrentMetaMode=\
|
"CurrentMetaMode=\
|
||||||
DFP-5.8: 1920x1200 @1200x1920 +0+0 {ForceCompositionPipeline=On, ViewPortIn=1200x1920, ViewPortOut=1920x1200+0+0, Rotation=270}, \
|
DFP-5.8: 1920x1200 @1200x1920 +0+0 {ForceCompositionPipeline=On, ViewPortIn=1200x1920, ViewPortOut=1920x1200+0+0, Rotation=270}, \
|
||||||
DFP-0.1: 3440x1440 @3440x1440 +1200+0 {ForceCompositionPipeline=On, ViewPortIn=3440x1440, ViewPortOut=3440x1440+0+0, Rotation=0}, \
|
DFP-0.1: 3440x1440 @3440x1440 +1200+0 {ForceCompositionPipeline=On, ViewPortIn=3440x1440, ViewPortOut=3440x1440+0+0, Rotation=0}, \
|
||||||
DFP-0.8: 2560x1440 @2560x1440 +4640+0 {ForceCompositionPipeline=On, ViewPortIn=2560x1440, ViewPortOut=2560x1440+0+0, Rotation=0}"
|
DFP-0.8: 2560x1440 @2560x1440 +4640+0 {ForceCompositionPipeline=On, ViewPortIn=2560x1440, ViewPortOut=2560x1440+0+0, Rotation=0}"
|
||||||
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
63
src/main.rs
63
src/main.rs
@ -3,36 +3,41 @@ use anyhow::Result;
|
|||||||
use fixscreen::*;
|
use fixscreen::*;
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
|
let dell = Screen {
|
||||||
|
name: ("DELL U2415".to_string()),
|
||||||
|
resolution: Resolution {
|
||||||
|
width: 1920,
|
||||||
|
height: 1200,
|
||||||
|
},
|
||||||
|
offset: Offset { x: 0, y: 360 },
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
let lg = Screen {
|
||||||
|
name: ("LG Electronics 34UM95".to_string()),
|
||||||
|
resolution: Resolution {
|
||||||
|
width: 3440,
|
||||||
|
height: 1440,
|
||||||
|
},
|
||||||
|
offset: Offset {
|
||||||
|
x: dell.resolution.width as isize,
|
||||||
|
y: 0,
|
||||||
|
},
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
let lenovo = Screen {
|
||||||
|
name: ("Lenovo Group Limited P27h-20".to_string()),
|
||||||
|
resolution: Resolution {
|
||||||
|
width: 2560,
|
||||||
|
height: 1440,
|
||||||
|
},
|
||||||
|
offset: Offset {
|
||||||
|
x: (dell.resolution.width + lg.resolution.width) as isize,
|
||||||
|
y: 0,
|
||||||
|
},
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
let cfg = Config {
|
let cfg = Config {
|
||||||
screens: vec![
|
screens: vec![dell, lg, lenovo],
|
||||||
Screen {
|
|
||||||
name: ("DELL U2415".to_string()),
|
|
||||||
resolution: Resolution {
|
|
||||||
width: 1920,
|
|
||||||
height: 1200,
|
|
||||||
},
|
|
||||||
orientation: Orientation::Left,
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
Screen {
|
|
||||||
name: ("LG Electronics 34UM95".to_string()),
|
|
||||||
resolution: Resolution {
|
|
||||||
width: 3440,
|
|
||||||
height: 1440,
|
|
||||||
},
|
|
||||||
offset: Offset { x: 1200, y: 0 },
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
Screen {
|
|
||||||
name: ("Lenovo Group Limited P27h-20".to_string()),
|
|
||||||
resolution: Resolution {
|
|
||||||
width: 2560,
|
|
||||||
height: 1440,
|
|
||||||
},
|
|
||||||
offset: Offset { x: 4640, y: 0 },
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let map = screen_mapping_from_xorg_log("/var/log/X.0.log")?;
|
let map = screen_mapping_from_xorg_log("/var/log/X.0.log")?;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user