config: add jay.env file#1121
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a centralized environment-variable layer (src/env.rs) that can also load overrides from a jay.env file in Jay’s config directory, and migrates existing std::env lookups / hardcoded env-var name constants to this new mechanism across the compositor and CLI tooling.
Changes:
- Add
src/env.rsto loadjay.env, provide typed env accessors, and unify env-var naming/precedence. - Migrate many call sites (compositor, portal, dbus, xwayland, Vulkan, cursor handling, CLI tools) to use
crate::env::*instead of ad-hocstd::envreads and local constants. - Add CLI global options (
--log-level,--config-dir) and update docs to describejay.envand config-dir resolution.
Reviewed changes
Copilot reviewed 54 out of 54 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/xwayland.rs | Switch DISPLAY env handling to crate::env. |
| src/xcon/xauthority.rs | Load XAUTHORITY/HOME via crate::env accessors. |
| src/xcon.rs | Read DISPLAY via crate::env accessor. |
| src/vulkan_core.rs | Use JAY_VULKAN_VALIDATION from crate::env. |
| src/utils/xrd.rs | Remove legacy XDG_RUNTIME_DIR helper. |
| src/utils/nice.rs | Use JAY_NO_REALTIME and config dir via crate::env. |
| src/utils.rs | Remove utils::xrd module export. |
| src/tools/tool_client.rs | Derive log level and env paths from crate::env; adjust API. |
| src/tagged_acceptor.rs | Use XDG_RUNTIME_DIR from crate::env. |
| src/state.rs | Change State.config_dir to Option<&'static str>. |
| src/portal/ptl_display.rs | Adjust runtime-dir watch path type usage. |
| src/portal.rs | Use XDG_RUNTIME_DIR and initial_log_level() from crate::env; store runtime dir as &'static str. |
| src/pipewire/pw_con.rs | Use XDG_RUNTIME_DIR from crate::env. |
| src/main.rs | Add the new env module. |
| src/logind.rs | Use XDG_SESSION_ID from crate::env. |
| src/logger.rs | Log jay.env settings during logger install. |
| src/ifs/wl_surface/prime.rs | Use JAY_NO_CLIENT_PRIME from crate::env. |
| src/gfx_apis/vulkan/device.rs | Use JAY_NO_DESCRIPTOR_HEAP from crate::env. |
| src/forker.rs | Use env-var names via crate::env (DISPLAY/WAYLAND_DISPLAY). |
| src/env.rs | New module: parse/load jay.env, typed env accessors, config dir + initial log level. |
| src/ei/ei_acceptor.rs | Use XDG_RUNTIME_DIR from crate::env. |
| src/dbus.rs | Use DBUS_SESSION_BUS_ADDRESS / XDG_RUNTIME_DIR from crate::env and improve warnings. |
| src/cursor.rs | Use cursor-related env vars via crate::env. |
| src/control_center/cc_xwayland.rs | Display DISPLAY name via crate::env. |
| src/control_center/cc_compositor.rs | Display WAYLAND_DISPLAY/config dir via crate::env. |
| src/config/handler.rs | Use WAYLAND_DISPLAY name via crate::env; adjust config-dir response for new type. |
| src/config.rs | Use JAY_NO_REALTIME from crate::env; adjust config-dir plumbing for new type. |
| src/compositor.rs | Use initial_log_level()/config_dir()/WAYLAND_DISPLAY from crate::env; remove legacy constants + config_dir impl. |
| src/cli/xwayland.rs | Update tool-client initialization API (log level via env). |
| src/cli/unlock.rs | Update tool-client initialization API (log level via env). |
| src/cli/tree.rs | Update tool-client initialization API (log level via env). |
| src/cli/set_log_level.rs | Update tool-client initialization API (log level via env). |
| src/cli/seat_test.rs | Update tool-client initialization API (log level via env). |
| src/cli/screenshot.rs | Update tool-client initialization API (log level via env). |
| src/cli/run_tagged.rs | Use WAYLAND_DISPLAY name via crate::env; update tool-client init API. |
| src/cli/run_privileged.rs | Use XDG_RUNTIME_DIR/WAYLAND_DISPLAY/initial_log_level() via crate::env. |
| src/cli/reexec.rs | Update tool-client initialization API (log level via env). |
| src/cli/randr.rs | Update tool-client initialization API (log level via env). |
| src/cli/quit.rs | Update tool-client initialization API (log level via env). |
| src/cli/pid.rs | Update tool-client initialization API (log level via env). |
| src/cli/log.rs | Update tool-client initialization API (log level via env). |
| src/cli/input.rs | Update tool-client initialization API (log level via env). |
| src/cli/idle.rs | Update tool-client initialization API (log level via env). |
| src/cli/damage_tracking.rs | Update tool-client initialization API (log level via env). |
| src/cli/control_center.rs | Update tool-client initialization API (log level via env). |
| src/cli/config.rs | Use config_dir()/initial_log_level() from crate::env. |
| src/cli/color_management.rs | Update tool-client initialization API (log level via env). |
| src/cli/clients.rs | Update tool-client initialization API (log level via env). |
| src/cli.rs | Add global --log-level/--config-dir and plumb into crate::env OnceLocks. |
| src/backends/metal/allocator.rs | Use JAY_PRIME_METHODS from crate::env. |
| src/acceptor.rs | Use XDG_RUNTIME_DIR from crate::env. |
| book/src/environment-variables.md | Document jay.env, config-dir resolution, and JAY_LOG_LEVEL. |
| book/src/configuration/index.md | Document config-dir override and jay.env placement. |
| book/src/cli.md | Document new global CLI options (--log-level, --config-dir). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.