wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.03k stars 768 forks source link

Reduction in display number and size makes wezterm unusable #4915

Open j-xella opened 8 months ago

j-xella commented 8 months ago

What Operating System(s) are you seeing this problem on?

Windows

Which Wayland compositor or X11 Window manager(s) are you using?

not relevant

WezTerm version

20240127-113634-bbcac864

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

No, and I'll explain why below

Describe the bug

I work remotely, connecting to my PC via Citrix gateway. It means that when I am connected, I have several big displays. However, when I disconnect, the remote PC "thinks" that both the number of displays and their sizes became drastically smaller. And because wezterm is very sensitive to changes in display configuration, it tries to shrink, I believe.

Sometimes it works, and when I reconnect, the wezterm instance is still usable, even if resized to smaller number of rows and cols. However, from time to time, something goes wrong and I get this:

image

Notice that I also included some other windows in the screenshot. This is to show what the font size is normally on my system, and wezterm font size should be similar. But it is not. It looks like when wezterm window got smaller, wezterm tried to repaint everything on a smaller canvas, without reducing the number or rows/cols, but changing the size of letters. And got stuck in the process. For that wezterm window is half-dead now. It can be moved and resized, but all it does is repaints the current image, stretching it accordingly. It does not respond to any key presses. All I can do now is kill this instance of wezterm with task manager and restart again.

P.S. Sorry for not trying the latest greatest build, but this problems has been there since forever, it is still present as of the release that I tested, so it is probably still there ...

To Reproduce

  1. Get access to a system where the number of displays can be easily changed from big to small
  2. Repeat until it breaks: 2.1 On "big" displays, stretch wezterm as tall and wide as possible 2.2 Change display config from "big" to "small"

Configuration

config.hide_tab_bar_if_only_one_tab = true

config.window_decorations = "INTEGRATED_BUTTONS|RESIZE"

-- config.exit_behavior = "Hold" -- for debugging
config.ssh_backend = "Ssh2"

config.window_frame = {
  border_left_width = 1,
  border_right_width = 1,
  border_bottom_height = 1,
  border_top_height = 1,
  border_left_color = 'silver',
  border_right_color = 'silver',
  border_bottom_color = 'silver',
  border_top_color = 'silver',
}

config.window_padding = {
  left = 3,
  -- right = 3,
  top = 3,
  bottom = 3,
}

config.enable_scroll_bar = true
-- How many lines of scrollback you want to retain per tab
config.scrollback_lines = 10000

config.cursor_blink_rate = 1000
config.cursor_blink_ease_in = "Ease"
config.cursor_blink_ease_out = "Constant"
config.default_cursor_style = 'BlinkingBlock'
-- config.cursor_thickness = "200%"

--[[ config.colors = {
  cursor_bg = '#005500',
  cursor_fg = 'white',
} --]]

config.color_scheme = 'Catppuccin Mocha'

config.front_end = 'WebGpu' -- works much faster via RDP, see also https://github.com/wez/wezterm/issues/2876
config.webgpu_power_preference = 'HighPerformance'

Expected Behavior

Wezterm gets resized to smaller size all the time, but never becomes unusable.

Logs

No response

Anything else?

wez commented 8 months ago

I'm not clear what you mean by reducing the number of size of the displays; can you spell this out in more concrete terms? Perhaps the output from wezterm.gui.screens() in the debug overlay (press CTRL-SHIFT-L, then type that in and press enter) and how it varies before/after could help to illustrate this?

j-xella commented 8 months ago

Sorry if is is not clear. My remote PC is just a box connected to power and network. It has no physical displays. When I connect to it remotely, Citrix software emulates virtual displays, and it can be anything. And it changes dynamically. If I run Citrix client on my client PC in full screen, then virtual displays usually mirror either all or a subset of the real displays of my client PC. This happens when I connect. If I run Citrix client in a window, then the remote PC has a display the size of that window, which will change if I resize that window.

Here is an example of my display config when I am connected to my remote PC, as seen on that remote PC:

image

Those are "virtual" displays that mirror physical displays of my client PC that I connect from.. They have resolutions of 1920x1080 , 1080x1920 and 2560x1440 pixels respectively. When working, I usually stretch my wezterm across multiple displays, so it has hundreds of rows and cols.

When I disconnect from my remote PC, I believe the remote PC sees the change in both the number and resolution of those virtual displays. It is as if someone unplugged those 3 displays and plugged one display instead, with some basic resolution of 800x600 or similar.

When I am connected and all is OK, the output of wezterm.gui.screens() is

{
    "active": {
        "effective_dpi": 96,
        "height": 1440,
        "max_fps": 60,
        "name": "DISPLAY22: Generic PnP Monitor on Citrix Indirect Display Adapter",
        "scale": 1,
        "width": 2560,
        "x": 0,
        "y": 0,
    },
    "by_name": {
        "DISPLAY21: Citrix/NVIDIA on Citrix Indirect Display Adapter": {
            "effective_dpi": 120,
            "height": 1080,
            "max_fps": 60,
            "name": "DISPLAY21: Citrix/NVIDIA on Citrix Indirect Display Adapter",
            "scale": 1,
            "width": 1920,
            "x": -3000,
            "y": 170,
        },
        "DISPLAY22: Generic PnP Monitor on Citrix Indirect Display Adapter": {
            "effective_dpi": 96,
            "height": 1440,
            "max_fps": 60,
            "name": "DISPLAY22: Generic PnP Monitor on Citrix Indirect Display Adapter",
            "scale": 1,
            "width": 2560,
            "x": 0,
            "y": 0,
        },
        "DISPLAY23: Generic PnP Monitor on Citrix Indirect Display Adapter": {
            "effective_dpi": 96,
            "height": 1920,
            "max_fps": 60,
            "name": "DISPLAY23: Generic PnP Monitor on Citrix Indirect Display Adapter",
            "scale": 1,
            "width": 1080,
            "x": -1080,
            "y": -170,
        },
    },
    "main": {
        "effective_dpi": 96,
        "height": 1440,
        "max_fps": 60,
        "name": "DISPLAY22: Generic PnP Monitor on Citrix Indirect Display Adapter",
        "scale": 1,
        "width": 2560,
        "x": 0,
        "y": 0,
    },
    "origin_x": -3000,
    "origin_y": -170,
    "virtual_height": 1920,
    "virtual_width": 5560,
}

I am not sure what the output would be when disconnected, as I can't run this command then. But I imagine there would be just one element in "by_name" with some pretty low resolution.

wez commented 8 months ago

It's possible that https://github.com/wez/wezterm/pull/4876 will help here

j-xella commented 7 months ago

I have installed a recent nightly build several days ago ( wezterm 20240226-174525-22424c32 ), and the issue is still there

j-xella commented 7 months ago

Also, I usually run multiple instances of wezterm on my PC, connected to different remote PCs:

image

Note that one instance takes much more memory. This is the instance connected to my dev box, I usually stretch it across multiple screens, run nvim with many windows in it, etc.. Less work is done in other instances, often it is just shell. Hence the smaller memory footprint.

What I can say with 100% certainty is that it is always the most heavily used instance of Wezterm that gets affected.