From bf01b935bd480a80be5389b9938a722917efd94d Mon Sep 17 00:00:00 2001 From: Bananymous Date: Wed, 11 Sep 2024 22:18:08 +0300 Subject: [PATCH] WindowServer: Start Terminal with Super+Enter this allows doing something in GUI after Terminal is closed also WindowServer is now stopped with Super+Shift+E --- .../programs/WindowServer/WindowServer.cpp | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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) {