Add setupenv patch
This commit is contained in:
27
README.org
27
README.org
@@ -15,12 +15,14 @@
|
||||
- [[#numlock-capslock][Numlock Capslock]]
|
||||
- [[#per-tag][Per Tag]]
|
||||
- [[#restore-monitor][Restore Monitor]]
|
||||
- [[#setup-env][Setup Env]]
|
||||
- [[#vanity-gaps][Vanity Gaps]]
|
||||
- [[#warp-cursor][Warp Cursor]]
|
||||
- [[#dwl-configuration][dwl Configuration]]
|
||||
- [[#appearance][Appearance]]
|
||||
- [[#tagging][Tagging]]
|
||||
- [[#logging][Logging]]
|
||||
- [[#environment-variables][Environment Variables]]
|
||||
- [[#autostart][Autostart]]
|
||||
- [[#window-rules][Window Rules]]
|
||||
- [[#layouts][Layouts]]
|
||||
@@ -129,6 +131,14 @@ Moves clients to their old output when it is reattached.
|
||||
#define RESTORE_MONITOR_PATCH 1
|
||||
#+END_SRC
|
||||
|
||||
** [[https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/setupenv][Setup Env]]
|
||||
|
||||
Allow configuring environment variables in config.h
|
||||
|
||||
#+BEGIN_SRC c :tangle patches.def.h
|
||||
#define SETUPENV_PATCH 1
|
||||
#+END_SRC
|
||||
|
||||
** [[https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/vanitygaps][Vanity Gaps]]
|
||||
|
||||
Adds (inner) gaps between client windows and (outer) gaps between windows and the screen edge in a flexible manner.
|
||||
@@ -197,6 +207,23 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||
static int log_level = WLR_ERROR;
|
||||
#+END_SRC
|
||||
|
||||
** Environment Variables
|
||||
#+BEGIN_SRC c :tangle config.h
|
||||
#if SETUPENV_PATCH
|
||||
static const Env envs[] = {
|
||||
/* variable value */
|
||||
{ "TERM", "xterm-256color" },
|
||||
{ "SHELL", "/bin/fish" },
|
||||
{ "EDITOR", "emacs" },
|
||||
{ "GIT_EDITOR", "emacs" },
|
||||
{ "BROWSER", "vivaldi-stable" },
|
||||
{ "QT_QPA_PLATFORMTHEME", "qt6ct" },
|
||||
{ "_JAVA_AWT_WM_NONREPARENTING", "1" },
|
||||
{ "XDG_CURRENT_DESKTOP", "wlroots" },
|
||||
};
|
||||
#endif // SETUPENV_PATCH
|
||||
#+END_SRC
|
||||
|
||||
** Autostart
|
||||
|
||||
#+BEGIN_SRC c :tangle config.h
|
||||
|
@@ -26,6 +26,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" },
|
||||
};
|
||||
|
||||
/* Autostart */
|
||||
static const char *const autostart[] = {
|
||||
"wbg", "/path/to/your/image", NULL,
|
||||
|
14
config.h
14
config.h
@@ -28,6 +28,20 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||
|
||||
static int log_level = WLR_ERROR;
|
||||
|
||||
#if SETUPENV_PATCH
|
||||
static const Env envs[] = {
|
||||
/* variable value */
|
||||
{ "TERM", "xterm-256color" },
|
||||
{ "SHELL", "/bin/fish" },
|
||||
{ "EDITOR", "emacs" },
|
||||
{ "GIT_EDITOR", "emacs" },
|
||||
{ "BROWSER", "vivaldi-stable" },
|
||||
{ "QT_QPA_PLATFORMTHEME", "qt6ct" },
|
||||
{ "_JAVA_AWT_WM_NONREPARENTING", "1" },
|
||||
{ "XDG_CURRENT_DESKTOP", "wlroots" },
|
||||
};
|
||||
#endif // SETUPENV_PATCH
|
||||
|
||||
#if AUTOSTART_PATCH
|
||||
static const char *const autostart[] = {
|
||||
/* Display / Compositor Setup */
|
||||
|
11
dwl.c
11
dwl.c
@@ -276,6 +276,13 @@ typedef struct {
|
||||
int monitor;
|
||||
} Rule;
|
||||
|
||||
#if SETUPENV_PATCH
|
||||
typedef struct {
|
||||
const char *variable;
|
||||
const char *value;
|
||||
} Env;
|
||||
#endif // SETUPENV_PATCH
|
||||
|
||||
typedef struct {
|
||||
struct wlr_scene_tree *scene;
|
||||
|
||||
@@ -2880,6 +2887,10 @@ run(char *startup_cmd)
|
||||
if (!socket)
|
||||
die("startup: display_add_socket_auto");
|
||||
setenv("WAYLAND_DISPLAY", socket, 1);
|
||||
#if SETUPENV_PATCH
|
||||
for (size_t i = 0; i < LENGTH(envs); i++)
|
||||
setenv(envs[i].variable, envs[i].value, 1);
|
||||
#endif // SETUPENV_PATCH
|
||||
|
||||
/* Start the backend. This will enumerate outputs and inputs, become the DRM
|
||||
* master, etc */
|
||||
|
@@ -14,6 +14,8 @@
|
||||
|
||||
#define RESTORE_MONITOR_PATCH 1
|
||||
|
||||
#define SETUPENV_PATCH 1
|
||||
|
||||
#define VANITYGAPS_PATCH 1
|
||||
|
||||
#define WARPCURSOR_PATCH 1
|
||||
|
54
patches/setupenv-20240326.patch
Normal file
54
patches/setupenv-20240326.patch
Normal file
@@ -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
|
||||
|
Reference in New Issue
Block a user