summaryrefslogtreecommitdiff
path: root/dwl/dwl-patches/patches/systemd/systemd-0.7.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dwl/dwl-patches/patches/systemd/systemd-0.7.patch')
-rwxr-xr-xdwl/dwl-patches/patches/systemd/systemd-0.7.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/dwl/dwl-patches/patches/systemd/systemd-0.7.patch b/dwl/dwl-patches/patches/systemd/systemd-0.7.patch
new file mode 100755
index 0000000..f911997
--- /dev/null
+++ b/dwl/dwl-patches/patches/systemd/systemd-0.7.patch
@@ -0,0 +1,64 @@
+From 43b3026b0744d54287eada71c84ea8be174950c3 Mon Sep 17 00:00:00 2001
+From: Shringe <dashingkoso@gmail.com>
+Date: Sat, 12 Jul 2025 01:00:46 -0500
+Subject: [PATCH] basic implementation
+
+---
+ dwl.c | 34 ++++++++++++++++++++++++++++++++++
+ 1 file changed, 34 insertions(+)
+
+diff --git a/dwl.c b/dwl.c
+index c717c1d..4ba134d 100644
+--- a/dwl.c
++++ b/dwl.c
+@@ -680,6 +680,15 @@ cleanup(void)
+ wlr_xwayland_destroy(xwayland);
+ xwayland = NULL;
+ #endif
++ /* Stop systemd target */
++ if (fork() == 0) {
++ setsid();
++ execvp("systemctl", (char *const[]) {
++ "systemctl", "--user", "stop", "dwl-session.target", NULL
++ });
++ exit(1);
++ }
++
+ wl_display_destroy_clients(dpy);
+ if (child_pid > 0) {
+ kill(-child_pid, SIGTERM);
+@@ -2222,6 +2231,31 @@ run(char *startup_cmd)
+ die("startup: display_add_socket_auto");
+ setenv("WAYLAND_DISPLAY", socket, 1);
+
++ /* Import environment variables then start systemd target */
++ if (fork() == 0) {
++ setsid();
++
++ /* First: import environment variables */
++ pid_t import_pid = fork();
++ if (import_pid == 0) {
++ execvp("systemctl", (char *const[]) {
++ "systemctl", "--user", "import-environment",
++ "DISPLAY", "WAYLAND_DISPLAY", NULL
++ });
++ exit(1);
++ }
++
++ /* Wait for import to complete */
++ waitpid(import_pid, NULL, 0);
++
++ /* Second: start target */
++ execvp("systemctl", (char *const[]) {
++ "systemctl", "--user", "start", "dwl-session.target", NULL
++ });
++
++ exit(1);
++ }
++
+ /* Start the backend. This will enumerate outputs and inputs, become the DRM
+ * master, etc */
+ if (!wlr_backend_start(backend))
+--
+2.49.0
+