Spawn weston-terminal in udev example on keycode

This commit is contained in:
Drakulix 2017-12-21 16:26:00 +01:00
parent d0046e4c60
commit 943b59a107
1 changed files with 5 additions and 1 deletions

View File

@ -34,7 +34,7 @@ use smithay::backend::drm::{DrmBackend, DrmDevice, DrmHandler};
use smithay::backend::graphics::GraphicsBackend; use smithay::backend::graphics::GraphicsBackend;
use smithay::backend::graphics::egl::EGLGraphicsBackend; use smithay::backend::graphics::egl::EGLGraphicsBackend;
use smithay::backend::input::{self, Event, InputBackend, InputHandler, KeyboardKeyEvent, PointerButtonEvent, 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::libinput::{LibinputInputBackend, libinput_bind, PointerAxisEvent as LibinputPointerAxisEvent, LibinputSessionInterface};
use smithay::backend::udev::{UdevBackend, UdevHandler, udev_backend_bind}; use smithay::backend::udev::{UdevBackend, UdevHandler, udev_backend_bind};
use smithay::backend::session::{Session, SessionNotifier}; use smithay::backend::session::{Session, SessionNotifier};
@ -52,6 +52,7 @@ use std::rc::Rc;
use std::sync::Arc; use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::atomic::{AtomicBool, Ordering};
use std::time::Duration; use std::time::Duration;
use std::process::Command;
use xkbcommon::xkb::keysyms as xkb; use xkbcommon::xkb::keysyms as xkb;
use wayland_server::{StateToken, StateProxy}; use wayland_server::{StateToken, StateProxy};
use wayland_server::protocol::{wl_output, wl_pointer}; use wayland_server::protocol::{wl_output, wl_pointer};
@ -94,6 +95,9 @@ impl InputHandler<LibinputInputBackend> for LibinputInputHandler {
if modifiers.ctrl && modifiers.alt && keysym == xkb::KEY_BackSpace { if modifiers.ctrl && modifiers.alt && keysym == xkb::KEY_BackSpace {
self.running.store(false, Ordering::SeqCst); self.running.store(false, Ordering::SeqCst);
false false
} else if modifiers.logo && keysym == xkb::KEY_Return && state == KeyState::Pressed {
let _ = Command::new("weston-terminal").spawn();
false
} else { } else {
true true
} }