This might be a bit of a noobish question for here, so sorry if it's the wrong place for it. I'm working on a personal project and part of what I want to do is turn the screen on and off when I get certain events. I've got it working using std::command and running xset -display :0 dpms force off/on
. I'd like to try to use x11rb to see if that's faster. When I use the code below nothing happens, but I don't get any errors, so I don't know why it's not working. I'm not too experienced at using x in code. If anyone knows, what I'm doing wrong, I'd really appreciate your help.
use x11rb::{self, protocol::dpms};
fn main() {
let (conn, screen_num) = x11rb::connect(Some(":0")).unwrap();
dpms::force_level(&conn, dpms::DPMSMode::OFF);
}