From 943b59a107ce8f7eec31f4806d0c42ee60da3601 Mon Sep 17 00:00:00 2001 From: Drakulix Date: Thu, 21 Dec 2017 16:26:00 +0100 Subject: [PATCH] Spawn weston-terminal in udev example on keycode --- examples/udev.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/udev.rs b/examples/udev.rs index accbb0b..830d178 100644 --- a/examples/udev.rs +++ b/examples/udev.rs @@ -34,7 +34,7 @@ use smithay::backend::drm::{DrmBackend, DrmDevice, DrmHandler}; use smithay::backend::graphics::GraphicsBackend; use smithay::backend::graphics::egl::EGLGraphicsBackend; use smithay::backend::input::{self, Event, InputBackend, InputHandler, KeyboardKeyEvent, PointerButtonEvent, - PointerAxisEvent}; + PointerAxisEvent, KeyState}; use smithay::backend::libinput::{LibinputInputBackend, libinput_bind, PointerAxisEvent as LibinputPointerAxisEvent, LibinputSessionInterface}; use smithay::backend::udev::{UdevBackend, UdevHandler, udev_backend_bind}; use smithay::backend::session::{Session, SessionNotifier}; @@ -52,6 +52,7 @@ use std::rc::Rc; use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; use std::time::Duration; +use std::process::Command; use xkbcommon::xkb::keysyms as xkb; use wayland_server::{StateToken, StateProxy}; use wayland_server::protocol::{wl_output, wl_pointer}; @@ -94,6 +95,9 @@ impl InputHandler for LibinputInputHandler { if modifiers.ctrl && modifiers.alt && keysym == xkb::KEY_BackSpace { self.running.store(false, Ordering::SeqCst); false + } else if modifiers.logo && keysym == xkb::KEY_Return && state == KeyState::Pressed { + let _ = Command::new("weston-terminal").spawn(); + false } else { true }