kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.33k stars 978 forks source link

Kitty will stop rendering on non-focused monitors when using PaperWM in Gnome. #7992

Closed luisbc92 closed 3 days ago

luisbc92 commented 3 days ago

Describe the bug When the extension PaperWM is used in Chrome, each monitor is assigned a separate workspace. Due to this behavior, windows that live on non-focused monitors are suspended, causing Kitty to pause rendering.

While this is not a Kitty bug, it would be possible to workaround this issue by allowing this behavior to be configurable.

Since this issue began with Kitty 0.35.0, I would expect the relevant functionality was introduced with this commit: https://github.com/kovidgoyal/kitty/commit/849dcd424db630dcac345874d2bc3665f04276c1

To Reproduce Steps to reproduce the behavior:

  1. Run Kitty on Gnome 47 with PaperWM extension.
  2. Move Kitty to a secondary monitor and run a process with live updating (ex. htop)
  3. Focus a window on main monitor
  4. Kitty will stop rendering in ~3s.

Environment details

kitty 0.33.1 created by Kovid Goyal
Linux barcelona 6.11.4-zen2-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Sun, 20 Oct 2024 18:20:07 +0000 x86_64
EndeavourOS Linux 6.11.4-zen2-1-zen (/dev/tty)

DISTRIB_ID="EndeavourOS"
DISTRIB_RELEASE="rolling"
DISTRIB_DESCRIPTION="EndeavourOS Linux"
DISTRIB_CODENAME="rolling"
Running under: Wayland
Frozen: False
Paths:
  kitty: /usr/bin/kitty
  base dir: /usr/lib/kitty
  extensions dir: /usr/lib/kitty/kitty
  system shell: /bin/zsh
Loaded config files:
  /home/luis/.config/kitty/kitty.conf

Config options different from defaults:
background_opacity         0.93
bold_font                  family='IosevkaTerm Nerd Font' style=Medium
bold_italic_font           family='IosevkaTerm Nerd Font' style='Medium Italic'
font_family                family='IosevkaTerm Nerd Font' style=Light
font_size                  10.0
hide_window_decorations    1
italic_font                family='IosevkaTerm Nerd Font' style='Light Italic'
linux_display_server       wayland
placement_strategy         top-left
shell                      tmux new-session -t main
single_window_margin_width FloatEdges(left=2.5, top=2.5, right=2.5, bottom=2.5)
text_composition_strategy  2.0 10
window_margin_width        FloatEdges(left=2.5, top=2.5, right=2.5, bottom=2.5)
Colors:
    background                 #192331   
    color0                     #3b4252   
    color1                     #bf616a   
    color10                    #a3be8c   
    color11                    #ebcb8b   
    color12                    #81a1c1   
    color13                    #b48ead   
    color14                    #8fbcbb   
    color15                    #eceff4   
    color2                     #a3be8c   
    color3                     #ebcb8b   
    color4                     #81a1c1   
    color5                     #b48ead   
    color6                     #88c0d0   
    color7                     #e5e9f0   
    color8                     #4c566a   
    color9                     #bf616a   
    cursor                     #81a1c1   
    foreground                 #cdcecf   

Important environment variables seen by the kitty process:
    PATH                                /usr/local/bin:/usr/bin:/usr/local/sbin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin
    LANG                                en_US.UTF-8
    EDITOR                              neovim
    SHELL                               /bin/zsh
    DISPLAY                             :0
    WAYLAND_DISPLAY                     wayland-0
    USER                                luis
    LC_ADDRESS                          en_US.UTF-8
    LC_IDENTIFICATION                   en_US.UTF-8
    LC_MEASUREMENT                      en_US.UTF-8
    LC_MONETARY                         en_US.UTF-8
    LC_NAME                             en_US.UTF-8
    LC_NUMERIC                          en_US.UTF-8
    LC_PAPER                            en_US.UTF-8
    LC_TELEPHONE                        en_US.UTF-8
    LC_TIME                             en_US.UTF-8
    XDG_DATA_DIRS                       /home/luis/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/
    XDG_RUNTIME_DIR                     /run/user/1000
    XDG_CURRENT_DESKTOP                 GNOME
    XDG_MENU_PREFIX                     gnome-
    XDG_SESSION_CLASS                   user
    XDG_SESSION_DESKTOP                 gnome
    XDG_SESSION_TYPE                    wayland
kovidgoyal commented 3 days ago

I am afraid I am not going to add configuration to workaround bugs in niche window managers, that way lies madness. You are welcome to run kitty from source and patch it as you need for your WM.

luisbc92 commented 3 days ago

Understood, thank you!

luisbc92 commented 43 minutes ago

I have a question around this feature. I understand that the XDG state changes to TOPLEVEL_STATE_SUSPENDED based on the assumption that the window is on a non-active workspace, and Kitty is disabling rendering accordingly.

However, why is this needed if Wayland correctly stops requesting render frames anyway? Wouldn't that trump the XDG state? Is this mechanism not available on X11?

Case in point, kitty is the only application suffering from this issue.

I'm not criticizing, and do not know enough about XDG, X11, or Wayland to call on the correct solution.

kovidgoyal commented 32 minutes ago

On Fri, Oct 25, 2024 at 08:46:51PM -0700, luisbc92 wrote:

I have a question around this feature. I understand that the XDG state changes to TOPLEVEL_STATE_SUSPENDED based on the assumption that the window is on a non-active workspace, and Kitty is disabling rendering accordingly.

However, why is this needed if Wayland correctly stops requesting render frames anyway? Wouldn't that trump the XDG state? Is this mechanism not available on X11?

You'd have to ask the Wayland developers why its needed. They added it.

Case in point, kitty is the only application suffering from this issue.

Yes kitty is unusually proactive in supporting Wayland. Other applications will get there eventually. PaperWM needs to stop doing the wrong thing and expecting applications to workaround it.