Bug 481577 - ship a window rule to keep picture-in-picture windows above
Summary: ship a window rule to keep picture-in-picture windows above
Status: RESOLVED INTENTIONAL
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (other bugs)
Version First Reported In: 5.93.0
Platform: Arch Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2024-02-20 11:37 UTC by Mariusz Libera
Modified: 2024-03-10 03:13 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mariusz Libera 2024-02-20 11:37:08 UTC
I understand that wayland protocol seems to be the long term solution, but how about a band aid in the meantime - a simple window rule enabled by default that forces picture-in-picture windows to be kept above. It seems to work fine.

Operating System: Arch Linux 
KDE Plasma Version: 5.93.0
KDE Frameworks Version: 5.249.0
Qt Version: 6.7.0
Kernel Version: 6.7.5-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 6800H with Radeon Graphics
Memory: 14.8 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Manufacturer: LENOVO
Product Name: 82RE
System Version: Legion 5 15ARH7
Comment 1 Nate Graham 2024-02-21 18:07:01 UTC
I would be super in favor of this if it works properly. Does it work fine with new PiP windows, not just the one you created it for? And are there rules that work for all PiP windows for both Firefox and Chrome/Chromium? Can you test those?
Comment 2 Mariusz Libera 2024-03-08 14:06:48 UTC
(In reply to Nate Graham from comment #1)
> I would be super in favor of this if it works properly. Does it work fine
> with new PiP windows, not just the one you created it for? And are there
> rules that work for all PiP windows for both Firefox and Chrome/Chromium?
> Can you test those?

This rule works fine for me, no issues whatsoever:

Description=Picture in picture for firefox
above=true
aboverule=3
title=Picture-in-Picture
titlematch=1
types=1
wmclass=firefox
wmclassmatch=1

Chrome seems to work fine out of the box, if it's run in xwayland, native wayland version needs a rule:

Description=Picture in picture for chrome
above=true
aboverule=3
title=Picture in picture
titlematch=1
types=1
wmclass=chrome
wmclassmatch=1

I would imagine that a regex would be needed to catch all chromium based browsers in 'wmclass'.
By the way, it would be nice if there was a checkbox to enable/disable window rules instead of having to delete and recreate them to test.
Comment 3 Vlad Zahorodnii 2024-03-08 15:29:42 UTC
> above=true
> aboverule=3

in plasma 6, I recommend to create a "layer" window rule instead to force pip windows to be placed in the overlay layer. With that, pip windows will be visible even if there's a fullscreen window.
Comment 4 Mariusz Libera 2024-03-08 18:47:35 UTC
(In reply to Vlad Zahorodnii from comment #3)
> > above=true
> > aboverule=3
> 
> in plasma 6, I recommend to create a "layer" window rule instead to force
> pip windows to be placed in the overlay layer. With that, pip windows will
> be visible even if there's a fullscreen window.

I wasn't aware of that, but it works even better.

Description=Picture in picture for firefox
layer=overlay
layerrule=2
title=Picture-in-Picture
titlematch=1
types=1
wmclass=firefox
wmclassmatch=1
Comment 5 Nate Graham 2024-03-08 23:17:37 UTC
An exact title match for "Picture-in-Picture" might work in English, but does this still work if the system is in another language?
Comment 6 Mariusz Libera 2024-03-09 05:42:56 UTC
(In reply to Nate Graham from comment #5)
> An exact title match for "Picture-in-Picture" might work in English, but
> does this still work if the system is in another language?

Good point, just checked, Firefox does indeed translate that. Wouldn't expect it. Well, this is pretty hopeless then.
Comment 7 Nate Graham 2024-03-10 03:13:58 UTC
Indeed. It's a shame, I'd like to ship a workaround too, as this is a real issue that annoys people. But as you can see, sometimes life doesn't cooperate!