diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1f8c872..fd01ad0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: [push, pull_request] env: CARGO_TERM_COLOR: always - RUST_BACKTRACE: 1 + RUST_BACKTRACE: full jobs: build: diff --git a/src/platform/wake_displays.rs b/src/platform/wake_displays.rs index 233f988..d6331bc 100644 --- a/src/platform/wake_displays.rs +++ b/src/platform/wake_displays.rs @@ -44,20 +44,20 @@ pub fn wake_displays() -> Result<()> { use std::{thread, time}; use uinput::{Device, event::keyboard}; - fn make_kbd_device() -> Result { - Ok(uinput::default()? + let mut device = uinput::default()? .name("display-switch")? - .event(uinput::event::Keyboard::All)? - .create()?) - } + .mouse(uinput::event::mouse::Relative::X)? + .create()?; - let mut device = make_kbd_device().context("Couldn't wake displays: couldn't configure uinput")?; // This sleep appears to be necessary based on testing. // Possibly X does not immediately recognize the new device? thread::sleep(time::Duration::from_secs(1)); - device.click(&keyboard::Key::RightAlt)?; + device.send(uinput::event::mouse::relative::X(-1))?; + device.synchronize()?; + thread::sleep(time::Duration::from_millis(50)); + device.send(uinput::event::mouse::relative::X(1))?; device.synchronize()?; Ok(()) }