summaryrefslogtreecommitdiffstats
path: root/dwl-patches/patches/setupenv/setupenv.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dwl-patches/patches/setupenv/setupenv.patch')
-rw-r--r--dwl-patches/patches/setupenv/setupenv.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/dwl-patches/patches/setupenv/setupenv.patch b/dwl-patches/patches/setupenv/setupenv.patch
new file mode 100644
index 0000000..17d2ad4
--- /dev/null
+++ b/dwl-patches/patches/setupenv/setupenv.patch
@@ -0,0 +1,54 @@
+From 11ee2fc23ef5728d1e132f338c08a7805c6109b2 Mon Sep 17 00:00:00 2001
+From: choc <notchoc@proton.me>
+Date: Tue, 26 Mar 2024 21:02:16 +0800
+Subject: [PATCH] implement setupenv
+
+---
+ config.def.h | 5 +++++
+ dwl.c | 7 +++++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/config.def.h b/config.def.h
+index 9009517..b16189a 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -20,6 +20,11 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
+ /* logging */
+ static int log_level = WLR_ERROR;
+
++static const Env envs[] = {
++ /* variable value */
++ { "XDG_CURRENT_DESKTOP", "wlroots" },
++};
++
+ static const Rule rules[] = {
+ /* app_id title tags mask isfloating monitor */
+ /* examples:
+diff --git a/dwl.c b/dwl.c
+index 5867b0c..b7d522b 100644
+--- a/dwl.c
++++ b/dwl.c
+@@ -230,6 +230,11 @@ typedef struct {
+ int monitor;
+ } Rule;
+
++typedef struct {
++ const char *variable;
++ const char *value;
++} Env;
++
+ typedef struct {
+ struct wlr_scene_tree *scene;
+
+@@ -2066,6 +2071,8 @@ run(char *startup_cmd)
+ if (!socket)
+ die("startup: display_add_socket_auto");
+ setenv("WAYLAND_DISPLAY", socket, 1);
++ for (size_t i = 0; i < LENGTH(envs); i++)
++ setenv(envs[i].variable, envs[i].value, 1);
+
+ /* Start the backend. This will enumerate outputs and inputs, become the DRM
+ * master, etc */
+--
+2.44.0
+