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.
This commit is contained in:
Leah Amelia Chen
2025-02-09 19:52:09 +01:00
committed by Mitchell Hashimoto
parent f8b547f92e
commit 56ea6c406c
11 changed files with 92 additions and 37 deletions

View File

@@ -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",