-
-
Notifications
You must be signed in to change notification settings - Fork 801
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
Incorrect initial terminal size on macOS with multiple screens #2958
Comments
On macOS, the system won't let you open a window larger than the screen will allow and will resize it smaller, so my initial suspicion is something like that, depending on the size/dpi of your screen. Please open the debug overlay ( Then, run:
that will log some information about the selected geometry in the first 20-30 lines; please share the output here. |
|
Can you talk me through what is happening in the log? It looks like the window is opened at 160x32 on the retina display then is resized after being created at the correct size, and then lands on 322x57 size... but at 72dpi. Is the window getting opened and staying on the retina display? Is being moved to/from the C24F390 display? |
Indeed, it seems that macOS has much to do with this issue. In the case above my setup is:
When I disconnect C24F390, the issue is gone. Size of wezterm is as expected when it opens. |
Thanks; I think the issue lies within this code: wezterm/window/src/os/macos/window.rs Lines 490 to 509 in 730c41b
I think it probably needs a little bit of smarts to avoid assuming |
I made a change that may help with this. It should be available in the next nightly build in about an hour from the time this comment is posted. Please try it out and let me know how you get on! |
Can you try a recent nightly build? |
Unfortunatelly with |
There are a number of open issues that relate to getting the dpi wrong when spawning a window. In theory it shouldn't matter because we will immediately realize the difference and synthesize the correct information, but evidence shows this isn't quite true. What this commit does is: * Override Connection::default_dpi() on macOS to return the effective_dpi from the active screen instead of the default non-retina dpi * Adjust the Config::initial_size() method to accept an optional cell pixel dimension * Add a helper function to wezterm-gui to compute the cell pixel dimensions given the config and the (usually default) dpi, and feed that through to Config::initial_size * in the macos window impl, scale the computed geometry based on the ratio of the Connection::default_dpi and the default non-retina dpi. This helps to avoid needing to do a fixup in the #4966 case, and may help with the various other macos quirky issues. refs: #2958 refs: #3575 refs: #3900 refs: #4250 refs: #4285 refs: #4447 refs: #4851 refs: #4966
I'm also experiencing this problem, though it seems to be related to using external (to wezterm) fonts for me. The version I'm using is 20240226-174525-22424c32 I've attached my simple config where I've set initial columns/rows to 128x24, but using font MesloLGS gives me 258x48, while using FiraCode or IntelOne Mono gives me 276x50 when launching on my external display. If I don't set a font I get the expected 128x24 when launching on my external display. Launching on the built-in display gives me the expected 128x24 for all fonts, so my workaround is to launch there and move the terminal to my external display, though I wish I didn't have to do that of course. wezterm-simple-config.txt |
I suspect I am seeing the same issue. I have it set-up so that wezterm launches maximized with the following: wezterm.on('gui-startup', function(cmd)
local tab, pane, window = mux.spawn_window(cmd or {})
window:gui_window():maximize()
end) I've included debug logs for both the built-in monitor (which opens maximized, as expected) and my Dell external monitor (which opens as a small window in the upper left) in the following gist -- included is a screenshot of the terminal opening small in the external monitor |
I was affected by this issue for a long time, and so I finally decided to investigate it further. When you have a setup with Retina screen (such as MBP internal screen) and non-Retina external monitor, Here is one of the setups I have checked: The top display is an external non-Retina monitor and the bottom one is an internal MBP Retina display. As you can see, non-Retina display (which has both frame and backing frame (width of 3440, height of 1440), and scale of 1) is bigger than the internal one (which has frame (width of 1728, height of 1117) and backing frame (width of 3456, height of 2234), and scale of 2). But Some helpful resources I used while trying to understand macOS's behavior: I opened a draft PR that adds additional logs and the results from running on my machine. Hopefully it will be helpful with fixing this issue. |
What Operating System(s) are you seeing this problem on?
macOS
Which Wayland compositor or X11 Window manager(s) are you using?
No response
WezTerm version
20230113-210839-14c749e
Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?
Yes, and I updated the version box above to show the version of the nightly that I tried
Describe the bug
Wzterm opens up with incorrect number of rows and cols:
This applies only to large numbers. Small sizes work correctly:
To Reproduce
Open wezterm with settings shown on the screenshots above.
Configuration
Correct configuration:
Incorrect configuration:
Expected Behavior
tput cols
corresponds toinitial_cols
.tput lines
corresponds toinitial_rows
.Logs
not available
Anything else?
I observed the same for the latest nightly version:
wezterm 20230113-210839-14c749e
The text was updated successfully, but these errors were encountered: