mirror of
				https://codeberg.org/dwl/dwl-patches.git
				synced 2025-11-04 05:54:20 +00:00 
			
		
		
		
	Eliminated wiki. Individual patches have a README.md explanation in their own subdirectory. Simplified submission of new patches and maintenance of existing patches. Instructions page (README.md autodisplayed) is now at https://codeberg.org/dwl/dwl-patches/
		
			
				
	
	
		
			55 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
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
 | 
						|
 |