Skip to content
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

On Wayland, title is not updated when window is invisible #2629

Closed
maximbaz opened this issue May 5, 2020 · 6 comments
Closed

On Wayland, title is not updated when window is invisible #2629

maximbaz opened this issue May 5, 2020 · 6 comments

Comments

@maximbaz
Copy link
Contributor

maximbaz commented May 5, 2020

Initially reported to sway: swaywm/sway#5104

Those repro steps might be a bit too sway-specific, but in short, run sleep 5s && printf "\e]2;%s\a" "new title", hide the kitty window and observe the title - it doesn't change until kitty window is made visible again.

As suggested in that thread, the issue happens because kitty is blocking when window is hidden, and is not listening on frame events - and for example alacritty does not have this issue.

Is there anything we can do on kitty side to support this?

On the one hand, there is GLFW issue: glfw/glfw#1350

On the other hand, it seems something like this has caused a copy-paste bug in the past (#1051 and swaywm/sway#2770) and it was somehow worked around in kitty itself?

As far as I understand, those frame events that kitty is not listening on, is not something sway-specific, but something common in Wayland...

@kovidgoyal
Copy link
Owner

I dont use sway, so how does one set it up to hide windows and where dos
one see the title of a hidden window??

@kovidgoyal
Copy link
Owner

kovidgoyal commented May 5, 2020

And kitty most definitely does listen to frame events. And I dont really understand how this is supposed to work, if the window is hidden presumably the compositor is not sending an render frame events. So there wont be any to listen to anyway.

@maximbaz
Copy link
Contributor Author

maximbaz commented May 5, 2020

I dont use sway, so how does one set it up to hide windows and where dos one see the title of a hidden window??

In a tabbed window layout, so imagine you have two apps open, in tabbed layout they are not visible side by side, but both are "full screen" but one is on top of another. It looks like this, browser is on top, kitty behind running htop command:

image

And kitty most definitely does listen to frame events. And I dont really understand how this is supposed to work, if the window is hidden presumably the compositor is not sending an render frame events.

If in a terminal A I run WAYLAND_DEBUG=1 kitty, in a newly opened kitty instance (B) I then run sleep 5s && printf "\e]2;%s\a" "new title" and move back to A, I will see nothing for 5 seconds, after 5 seconds are over this will be printed:

[4180290.378]  -> wl_surface@21.frame(new id wl_callback@32)
[4180290.431]  -> wl_surface@21.commit()
[4180293.504]  -> wl_surface@21.frame(new id wl_callback@29)
[4180293.513]  -> wl_surface@21.commit()
[4180297.179]  -> wl_surface@21.frame(new id wl_callback@35)
[4180297.202]  -> wl_surface@21.commit()
[4180306.363]  -> wl_surface@21.frame(new id wl_callback@36)
[4180306.383]  -> wl_surface@21.commit()
[4180316.573]  -> wl_surface@21.frame(new id wl_callback@37)
[4180316.593]  -> wl_surface@21.commit()

This seems to indicate that a frame event was sent. As suggested in swaywm/sway#5104, we should expect xdg_toplevel@26.set_title("new title") to be there too, but it will only happen if I make instance B visible.

Does this make sense?

@kovidgoyal
Copy link
Owner

kovidgoyal commented May 5, 2020 via email

@maximbaz
Copy link
Contributor Author

maximbaz commented May 5, 2020

Ah okay, sure!

Minimal sway config:

set $mod Mod4
bindsym $mod+Return exec kitty
bindsym $mod+h focus left
bindsym $mod+l focus right
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
bindsym $mod+0 workspace 10

(you can change $mod to be anything you want, if Mod4 doesn't work - I believe it's alt by default)

  1. Press $mod+0 to navigate to an empty workspace

  2. Press $mod+Return to open kitty (we call this instance A)

  3. In kitty A, type WAYLAND_DEBUG=1 kitty which will open new window (kitty B) next to it

  4. Press $mod+w to switch to tabbed layout

    Now you should see something like this, window titles on top, both windows are in "full" size:

    image

  5. You can move between kitty A and B using $mod+h and $mod+l

  6. In kitty B, run sleep 5s && printf "\e]2;%s\a" "new title" and immediately move to kitty A using $mod+h

  7. Look at the window titles. The current title is so far default ("zsh" in my case), the one we want to change:

    image

  8. Wait 5 seconds. In kitty A you are looking at the events that are being sent to kitty B. After 5 seconds you will see that some events are being sent:

    [3156198.622]  -> wl_surface@21.frame(new id wl_callback@34)
    [3156198.667]  -> wl_surface@21.commit()
    [3156202.632]  -> wl_surface@21.frame(new id wl_callback@32)
    [3156202.663]  -> wl_surface@21.commit()
    

    But at the same time, the title of kitty B is still default ("zsh" in my case), not the "new title"

  9. Now go to kitty B using $mod+l and the title will be immediately updated.

  10. In kitty A, you will see event xdg_toplevel@26.set_title("new title"), we expect that this message shows after 5 seconds, but in practice it only appears after you make kitty B visible.


If you repeat the same experiment but with kitty B being visible at all times (basically same steps, but on step 4 instead of switching to tabbed layout using $mod+w you switch to split layout using $mod+e (press once or twice for vertical or horizontal, doesn't matter), and go through the same steps, on step 8 you will observe that title of kitty B is updated instantly as soon as 5 seconds are over.

@maximbaz
Copy link
Contributor Author

maximbaz commented May 5, 2020

I confirm that the issue is fixed, thank you very very much! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants