-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider adding a WT_PROFILE env var pointing to settings file #4566
Comments
@oising Are you able to access settings at all? I no longer find a |
@akulbe There's a readonly Run the following one-liner in powershell to open the notepad (join-path ((dir (gcm wt.exe).source).target | split-path) defaults.json) The |
Conflicts with #3589 request, maybe have the variable be WT_CONFIGFILE? Currently the location is pretty stable and discoverable, this change would only be relevant if you could also customize the path. |
Does anyone actually have a use for WT_Session? Is it just so you can distinguish different terminal connections to the same (e.g. ssh) session? To me, the WT_Profile in #3589 would be really useful. This one, pointing to the config file (confusingly named profile.json), would also be useful but it feels less useful -- isn't there only one location (plus one for dev builds)? |
Well there are actually two config files, in different locations - I propose: env var
env var
While they are "discoverable" - for certain definitions of discoverability - I think they are unwieldy enough to benefit from an environment variable. @Jaykul I really like your idea for the active profile ID. What do you suggest for a name? I think WT_PROFILE is too close to WT_PROFILES (which matches the name of the json file, likewise for WT_DEFAULTS) |
On February 20, 2020, @oising said:
Can you expand on what you mean by a read-only environment variable? Windows, doesn't have anything like read-only environment variables AFAIK. A process is free to modify its own environment or to start children with custom environments. My expectation of a variable like Based on how other, similar software works, I think it would make sense if Windows Terminal only read this environment variable at process start up and then monitored the path for changes. It would also be reasonable for Windows Terminal to detect changes to the environment "template" by handling |
@chwarr The WT_DEFAULTS environment variable will point to the readonly file defaults.json. It's not a readonly env var. As for your thoughts on WT_PROFILE, well, sure, that makes sense but I'm not sure that would make it into my PR. I'd imagine that may be something that gets haggled about for post v1.0. |
Ah, @oising was talking about the mutability of the file, not the variable. There's a related issue in this space, "Add support for roaming settings.json or storing it elsewhere". |
I've added |
So, here's the thing. I adore the work you did in #4852, and I'd like to land some of it as it improves environment handling in Terminal across the board. What I'm most worried about here is introducing what amounts to a public API this close to v1. As I reviewed it, I found myself asking some questions:
I'm wary of doing this for 1.0 because we don't have time to answer those questions. That doesn't mean we're not interested in the change overall. 😄 To turn the discussion around a bit, though... copying a comment from @Jaykul on the pull request:
Why would someone want this? Honest question. I realize it's the conjunction of If an application has specific color requirements, it shouldn't need to parse our settings files--both of them--then layer them with the exact same logic we do to figure out what colors the user's going to see. It should just set the palette it wants and be done with it, or use the 24-bit color escapes. We've been burned so many times, in so many ways, when we've offered public APIs or "detectables" to determine console/terminal state. People take dependencies on reserved flag values not being used (oops), and that consoles have an HWND (thanks SSH), and that the high 8 bits in a cell are unused when you're using the ANSI versions of the APIs (thanks Pascal). I think it's worth getting in #4852 without the path versions and only including the |
(Also, thank you for bearing with us as we release-engineer our first v1 of something: this is painful in part because I'm not communicating very well about it. I'm sorry.) |
@DHowett-MSFT If I'm reading this correctly, then you may ship this in v1.0 if I can drop the Update: It's done. Just remove two lines, and edited one. |
It's quite alright, Dustin. Thank you for your very thoughtful commentary. |
This commit adds a `WT_PROFILE_ID` environment variable, which contains the guid of the active profile. It also teaches ConptyConnection to take an environment map on creation. We had to do a little manual jiggery with the WSLENV environment variable as passed by the creator. * [x] CLA signed * [ ] Tests added/passed * [ ] Requires documentation to be updated * [x] I've discussed this with core contributors already. Ran terminal, validated vars and translated paths under windows and WSL. References #4566 (this PR originally introduced WT_SETTINGS/DEFAULTS) Closes #3589
Just to complicate things a little bit. What about The If you only give back the currently used, and editable path, it will be up to the users to decide what do they want to do with it. This approach sounds supportable in the future, because if you change the path - to support roaming or whatever - or the file name, etc., WT must always know where the active settings are, because it had to read the content. I'm editing the content of the It would be really nice if I can simply just use What do you think? |
|
How do you find the editable defaults.json file if I run notepad (join-path ((dir (gcm wt.exe).source).target | split-path) defaults.json) |
@bradrice Yep, that's correct. You shouldn't be editing |
The problem I have with Powershell and Windows Terminal is using a theme for vim. I would love to ise gruvbox. For some reason my vim has these red backgrounds with red type and I can't read it, when I'm using code completion that is flagging me of an error in my typescript. Is there a way to make a powershell terminal behave more like a linix or mac terminal with regard to respecting a vim colorscheme? |
You might be better off filing a new issue rather than bumping this old one. Probably best to include if you're using vim.exe or WSL vim, maybe a link to the vim scheme you're trying to use, and include your |
@bradrice you don't need the ALT button, a pure click on the Settings will open the |
You're right @zadjii-msft , I should keep issues separate. Thanks @sassdawe that helped. I didn't see the link to the json file when I hit settings. |
If the settings UI is not planned until after 1.0, then I strongly recommend adding an environment variable with the path to the json settings file, so it can be edited with the editor of choice (vi, notepad, nano, emacs, whatever) from within the shell of choice without burning brain calories trying to find it buried in AppData. Also: Relying on the GUI menu is, well, unreliable, due to there being no guarantee of a valid file association for json files.
We've already got
WT_SESSION
env var -- something likeWT_PROFILE
would be useful.Then from within cmd or powershell, I can easily edit settings with my preferred editor, or interactively using
$settings = gc $env:WT_PROFILE | convertto-json
and flipping settings on the object model directly before saving it back out.The text was updated successfully, but these errors were encountered: