diff options
| author | Leah Amelia Chen <hi@pluie.me> | 2025-02-09 19:52:09 +0100 |
|---|---|---|
| committer | Mitchell Hashimoto <m@mitchellh.com> | 2025-02-11 13:42:12 -0800 |
| commit | 56ea6c406c155a48947274cd871ae274e654c957 (patch) | |
| tree | 150cf57e5fb48af1e9553b2ead178cba40114329 /src/Surface.zig | |
| parent | f8b547f92e4d4da665b2c2f5757b39e53c60e042 (diff) | |
gtk(x11): set `WINDOWID` env var for subprocesses
`WINDOWID` is the conventional environment variable for scripts that
want to know the X11 window ID of the terminal, so that it may call
tools like `xprop` or `xdotool`. We already know the window ID for
window protocol handling, so we might as well throw this in for
convenience.
Diffstat (limited to 'src/Surface.zig')
| -rw-r--r-- | src/Surface.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Surface.zig b/src/Surface.zig index d9a985aa7..e7e8e20af 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -519,9 +519,17 @@ pub fn init( // This separate block ({}) is important because our errdefers must // be scoped here to be valid. { + var env_ = rt_surface.defaultTermioEnv() catch |err| env: { + // If an error occurs, we don't want to block surface startup. + log.warn("error getting env map for surface err={}", .{err}); + break :env null; + }; + errdefer if (env_) |*env| env.deinit(); + // Initialize our IO backend var io_exec = try termio.Exec.init(alloc, .{ .command = command, + .env = env_, .shell_integration = config.@"shell-integration", .shell_integration_features = config.@"shell-integration-features", .working_directory = config.@"working-directory", |
