diff --git a/userspace/programs/WindowServer/WindowServer.cpp b/userspace/programs/WindowServer/WindowServer.cpp index fb4397d4..fb01a616 100644 --- a/userspace/programs/WindowServer/WindowServer.cpp +++ b/userspace/programs/WindowServer/WindowServer.cpp @@ -11,6 +11,8 @@ #include #include +#include + WindowServer::WindowServer(Framebuffer& framebuffer) : m_framebuffer(framebuffer) , m_cursor({ framebuffer.width / 2, framebuffer.height / 2 }) @@ -135,13 +137,27 @@ void WindowServer::on_key_event(LibInput::KeyEvent event) return; } - // Quick hack to stop the window server - if (event.pressed() && event.key == LibInput::Key::Escape) + // Stop WindowServer with mod+shift+E + if (m_is_mod_key_held && event.pressed() && event.shift() && event.key == LibInput::Key::E) { m_is_stopped = true; return; } + // Start terminal with mod+Enter + if (m_is_mod_key_held && event.pressed() && event.key == LibInput::Key::Enter) + { + pid_t pid = fork(); + if (pid == 0) + { + execl("/usr/bin/Terminal", "Terminal", nullptr); + exit(1); + } + if (pid == -1) + perror("fork"); + return; + } + // Kill window with mod+Q if (m_is_mod_key_held && event.pressed() && event.key == LibInput::Key::Q) {