summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfadhil riyanto <me@fadev.org>2024-08-17 13:57:25 +0700
committerfadhil riyanto <me@fadev.org>2024-08-17 13:57:25 +0700
commitb907912f3eddef1878f39bd13df13831e4f6bb26 (patch)
treee4e3537acf91034bdcac944011730db408ca90f5
parent3e7869ca64f28cad50b237eb44df2424d1732488 (diff)
test notify send
Signed-off-by: fadhil riyanto <me@fadev.org>
-rw-r--r--init.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/init.c b/init.c
index 6fae895..fe2483e 100644
--- a/init.c
+++ b/init.c
@@ -98,6 +98,31 @@ static void get_bat_num(struct gc_data *gc)
read(*gc->openfd, gc->bat0bufptr, gc->file_sz);
}
+static void exec(struct gc_data *gc, char* bat0)
+{
+ int len = 2 + 1 + gc->file_sz;
+
+ char* snprintfbuf = (char*)malloc(len);
+ memset(snprintfbuf, '\0', len);
+
+ snprintf(snprintfbuf, len, "%s", bat0);
+
+ char* args[] = {
+ NOTIFY_SEND_PATH, snprintfbuf, NULL
+ };
+
+ char *env[] = {
+ "DISPLAY=:0.0",
+ "DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/dbus-YY3FKxW0FU",
+ "guid=89e1272fd6c1e0b8c15834a666c048cc",
+ "DBUS_SESSION_BUS_PID=68930", NULL
+ };
+
+ execve(NOTIFY_SEND_PATH, args, env);
+
+ free(snprintfbuf);
+}
+
int main(void)
{
@@ -106,10 +131,13 @@ int main(void)
setup_fd(&gc);
- get_bat_num(&gc);
- char* cropped = newline_cut(gc.bat0bufptr, &gc);
- printf("%s", cropped);
- free(cropped);
+ // while (!need_exit) {
+ // get_bat_num(&gc);
+ // char* cropped = newline_cut(gc.bat0bufptr, &gc);
+
+ // free(cropped);
+ // }
+ exec(&gc, "test test test");
run_garbage_collector_clear(&gc);
return 0;