Add LG monitor to the right center of main screens.

This commit is contained in:
Bill Thiede 2023-06-23 17:10:02 -07:00
parent 5a416f4552
commit 4429b6a6a6
2 changed files with 26 additions and 19 deletions

View File

@ -14,6 +14,7 @@ use xrandr::{XHandle, XrandrError};
pub fn swap_workspaces(cfg: &Config) -> Result<Vec<Result<Output, CommandError>>, CommandError> {
let monitors = XHandle::open()?.monitors()?;
dbg!(&monitors);
// TODO(wathiede): if I ever get two monitors with the same resolution, use EDID to find a
// better key.
let map: HashMap<_, _> = monitors

View File

@ -23,23 +23,6 @@ fn main() -> Result<()> {
workspaces: vec!["virtue".to_string()],
..Default::default()
};
let lg = Screen {
name: ("LG Electronics 34UM95".to_string()),
resolution: Resolution {
width: 3440,
height: 1440,
},
offset: Offset {
// 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 + dell24.resolution.height as isize,
y: 0,
},
workspaces: vec!["twilight".to_string()],
..Default::default()
};
let lenovo = Screen {
name: ("Lenovo Group Limited P27h-20".to_string()),
resolution: Resolution {
@ -51,12 +34,35 @@ fn main() -> Result<()> {
workspaces: vec!["fraud".to_string()],
..Default::default()
};
let screens = vec![dell24, dell30, lenovo];
let lg = Screen {
name: ("LG Electronics 34UM95".to_string()),
resolution: Resolution {
width: 3440,
height: 1440,
},
offset: Offset {
// 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 + dell24.resolution.width + dell30.resolution.width.max(lenovo.resolution.width))
as isize,
y: ((dell30.resolution.height + lenovo.resolution.height) / 2 - 1440 / 2) as isize,
},
workspaces: vec!["twilight".to_string()],
..Default::default()
};
let map = screen_mapping_from_xorg_log("/var/log/X.0.log")?;
let lg_connected = std::env::args().len() > 1;
let mut screens = vec![dell24, dell30, lenovo];
if lg_connected {
screens.push(lg);
}
let cfg = Config {
screens: screens.clone(),
};
let map = screen_mapping_from_xorg_log("/var/log/X.0.log")?;
let cmd = run_cmd(&map, &cfg)?;
println!("cmd {:#?}", cmd);
// TODO(wathiede): run xrandr --output $DPY --primary