bismuth icon indicating copy to clipboard operation
bismuth copied to clipboard

fix: Use optional chaining to fix error when windowId is undefined in Wayland

Open jkcdarunday opened this issue 1 year ago • 6 comments

Summary

On KWin Wayland (5.27.6), I noticed that bismuth is throwing the ff. error when tiling Firefox causing tiling to break so I investigated and was able to pinpoint the error. It turns out windowId is undefined for some apps so I changed it to optional chaining which fixed the problems I've been having with tiling.

org.kde.bismuth: arrangeScreen/finished,[object Object]
org.kde.bismuth: Oops! TypeError: Cannot read property 'toString' of undefined.
org.kde.bismuth: Client added: KWin::XwaylandWindow(0x556f7f219900)

Here's how it worked before this change (the other windows don't resize immediately, eventually they stop tiling altogether):

https://github.com/Bismuth-Forge/bismuth/assets/4564810/2baaaaa9-3902-4bc4-b28c-c1f6514ea2c5

Here's how it worked after this change (the other windows resize immediately):

https://github.com/Bismuth-Forge/bismuth/assets/4564810/7ccfb2f5-3cb6-40f6-bcf7-85a666b84cc8

Breaking Changes

Should not break anything.

UI Changes

None

Test Plan

  1. On KDE Plasma Wayland, open Firefox
  2. Open three new windows
  3. Close two of the three windows that you just opened a. The remaining windows should resize correctly b. Previously, these windows don't resize as one of the handlers throws the above error and fails to process the event

Related Issues

Potentially closes #473 or at least fixes one problem related to wayland.

jkcdarunday avatar Jul 13 '23 09:07 jkcdarunday

This change indeed fixes (or works around?) issue #473 for me. Thanks!

dobladez avatar Jul 13 '23 14:07 dobladez

I just installed Bismuth from your branch on openSUSE Tumbleweed, but it makes the screen very glitchy and half-tiling doesn't work (only quarter tiling). And some apps don't open at all.

Vistaus avatar Jul 20 '23 12:07 Vistaus

That's odd, everything works perfectly on mine and I don't think the change would prevent any window that already opens from opening. Probably a different problem.

jkcdarunday avatar Jul 21 '23 08:07 jkcdarunday

Thanks, this is great! Please merge this and get it into the Arch repos so I don't have to keep manually building things.

endeavour avatar Aug 03 '23 19:08 endeavour

Thanks! Great work! That's helped

owl-from-hogvarts avatar Aug 11 '23 09:08 owl-from-hogvarts

Thank you so much! ❤️ How much a single symbol can do for humanity 😁 I built the RPM package for Fedora 38 from the official spec file, here you go, maybe someone will need it (the process of building from source code is a pain for a normal human, don't want others to suffer).

bismuth_unpack_it.zip

farline99 avatar Aug 17 '23 11:08 farline99