Add LG monitor to the right center of main screens.
This commit is contained in:
parent
5a416f4552
commit
4429b6a6a6
@ -14,6 +14,7 @@ use xrandr::{XHandle, XrandrError};
|
|||||||
pub fn swap_workspaces(cfg: &Config) -> Result<Vec<Result<Output, CommandError>>, CommandError> {
|
pub fn swap_workspaces(cfg: &Config) -> Result<Vec<Result<Output, CommandError>>, CommandError> {
|
||||||
let monitors = XHandle::open()?.monitors()?;
|
let monitors = XHandle::open()?.monitors()?;
|
||||||
|
|
||||||
|
dbg!(&monitors);
|
||||||
// TODO(wathiede): if I ever get two monitors with the same resolution, use EDID to find a
|
// TODO(wathiede): if I ever get two monitors with the same resolution, use EDID to find a
|
||||||
// better key.
|
// better key.
|
||||||
let map: HashMap<_, _> = monitors
|
let map: HashMap<_, _> = monitors
|
||||||
|
|||||||
44
src/main.rs
44
src/main.rs
@ -23,23 +23,6 @@ fn main() -> Result<()> {
|
|||||||
workspaces: vec!["virtue".to_string()],
|
workspaces: vec!["virtue".to_string()],
|
||||||
..Default::default()
|
..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 {
|
let lenovo = Screen {
|
||||||
name: ("Lenovo Group Limited P27h-20".to_string()),
|
name: ("Lenovo Group Limited P27h-20".to_string()),
|
||||||
resolution: Resolution {
|
resolution: Resolution {
|
||||||
@ -51,12 +34,35 @@ fn main() -> Result<()> {
|
|||||||
workspaces: vec!["fraud".to_string()],
|
workspaces: vec!["fraud".to_string()],
|
||||||
..Default::default()
|
..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 {
|
let cfg = Config {
|
||||||
screens: screens.clone(),
|
screens: screens.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let map = screen_mapping_from_xorg_log("/var/log/X.0.log")?;
|
|
||||||
let cmd = run_cmd(&map, &cfg)?;
|
let cmd = run_cmd(&map, &cfg)?;
|
||||||
println!("cmd {:#?}", cmd);
|
println!("cmd {:#?}", cmd);
|
||||||
// TODO(wathiede): run xrandr --output $DPY --primary
|
// TODO(wathiede): run xrandr --output $DPY --primary
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user