summaryrefslogtreecommitdiff
path: root/hosts/mac/kmonad-daemon-shim/main.c
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2024-07-21 01:49:04 +0700
committerpolwex <polwex@sortug.com>2024-07-21 01:49:04 +0700
commite64f7a78e01e5fa661471cb518cc71fc33223b5a (patch)
tree691c444cf66e2f9d1ee63e4589ed09ec502baa3b /hosts/mac/kmonad-daemon-shim/main.c
parent0816d59542658a62928050ef5f08e1460e554959 (diff)
m
Diffstat (limited to 'hosts/mac/kmonad-daemon-shim/main.c')
-rw-r--r--hosts/mac/kmonad-daemon-shim/main.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/hosts/mac/kmonad-daemon-shim/main.c b/hosts/mac/kmonad-daemon-shim/main.c
new file mode 100644
index 0000000..a9f0596
--- /dev/null
+++ b/hosts/mac/kmonad-daemon-shim/main.c
@@ -0,0 +1,23 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+char *const kdv_client[] = {"@client@"};
+
+int main(int argc, char *argv[]) {
+ int r = fork();
+ if (r < 0) {
+ perror("kmonad-service-shim: fork");
+ return 1;
+ } else if (r == 0) {
+ r = execvp(kdv_client[0], kdv_client);
+ } else {
+ // To give time for kdv-client to start
+ sleep(1);
+ r = execvp("kmonad", argv);
+ };
+ if (r < 0) {
+ perror("kmonad-service-shim: execvp");
+ return 1;
+ }
+}