Make the desktop interactive: pointer/keyboard routing, launcher popup, app launching
CI / test (push) Successful in 25s

- server: wl_pointer/wl_keyboard events (enter/leave/motion/button/key/modifiers),
  host keymap shared with client keyboards
- nested: receives host pointer + keyboard + keymap, queues InputEvents
- host: routes input to the launcher popup or the window under the pointer;
  click-to-focus moves keyboard focus
- shell: launcher button opens lib/launcher popup; entries start real apps
  (foot, konsole, dolphin, firefox, kate, systemsettings if installed) with
  WAYLAND_DISPLAY pointed at the compositor
- sys: has_exe + spawn
- e2e test for input delivery and the launcher popup

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nandiandClaude Sonnet 5.5 committed 2026-11-24 19:11:15 -08:00
1 parent a1b85474f8
commit a63f65806d
10 files changed
+740 -33

No files matched your search

+41
View File
@@ -11,6 +11,7 @@
#include <sys/stat.h>
#include <sys/un.h>
#include <time.h>
#include <signal.h>
#include <unistd.h>
#include "moonbit.h"
@@ -310,3 +311,43 @@ int32_t mp_wall_time_field(int32_t which) {
default: return 0;
}
}
/* True when `name` resolves to an executable via PATH (or is an executable path). */
MOONBIT_FFI_EXPORT
int32_t mp_has_exe(moonbit_bytes_t name_bytes) {
char name[256];
bytes_to_cstr(name_bytes, name, sizeof(name));
if (strchr(name, '/')) return access(name, X_OK) == 0;
const char *path = getenv("PATH");
if (!path) return 0;
char *copy = strdup(path);
char *save = NULL;
int found = 0;
for (char *dir = strtok_r(copy, ":", &save); dir && !found; dir = strtok_r(NULL, ":", &save)) {
char full[1024];
snprintf(full, sizeof(full), "%s/%s", dir, name);
if (access(full, X_OK) == 0) found = 1;
}
free(copy);
return found;
}
/* Launch `cmd` detached, with WAYLAND_DISPLAY pointing at our socket. Returns 0 on fork success. */
MOONBIT_FFI_EXPORT
int32_t mp_spawn(moonbit_bytes_t cmd_bytes, moonbit_bytes_t display_bytes) {
char cmd[256];
char display[512];
bytes_to_cstr(cmd_bytes, cmd, sizeof(cmd));
bytes_to_cstr(display_bytes, display, sizeof(display));
signal(SIGCHLD, SIG_IGN); /* no zombies */
pid_t pid = fork();
if (pid < 0) return -1;
if (pid == 0) {
setsid();
setenv("WAYLAND_DISPLAY", display, 1);
unsetenv("DISPLAY");
execlp(cmd, cmd, (char *)NULL);
_exit(127);
}
return 0;
}