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
This commit is contained in:
Bananymous 2024-09-11 22:18:08 +03:00
parent 98c011e6a6
commit bf01b935bd
1 changed files with 18 additions and 2 deletions

View File

@ -11,6 +11,8 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <unistd.h>
WindowServer::WindowServer(Framebuffer& framebuffer) WindowServer::WindowServer(Framebuffer& framebuffer)
: m_framebuffer(framebuffer) : m_framebuffer(framebuffer)
, m_cursor({ framebuffer.width / 2, framebuffer.height / 2 }) , m_cursor({ framebuffer.width / 2, framebuffer.height / 2 })
@ -135,13 +137,27 @@ void WindowServer::on_key_event(LibInput::KeyEvent event)
return; return;
} }
// Quick hack to stop the window server // Stop WindowServer with mod+shift+E
if (event.pressed() && event.key == LibInput::Key::Escape) if (m_is_mod_key_held && event.pressed() && event.shift() && event.key == LibInput::Key::E)
{ {
m_is_stopped = true; m_is_stopped = true;
return; 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 // Kill window with mod+Q
if (m_is_mod_key_held && event.pressed() && event.key == LibInput::Key::Q) if (m_is_mod_key_held && event.pressed() && event.key == LibInput::Key::Q)
{ {