Skip to content

Add support for picture-in-picture windows #260

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

Closed
wants to merge 3 commits into from

Conversation

ElFitaFlores
Copy link

@ElFitaFlores ElFitaFlores commented Jul 20, 2025

Add support for picture-in-picture windows. Tested in Brave, Chromium and Firefox. It has the following characteristics:

  1. Floats over other windows.
  2. It is present in all the Hyprland workspaces.
  3. Keeps its aspect ratio when resized.
  4. Removed border.
  5. Removed transparency.

Before:
image

After:
image

Additional notes:

  • Originally I was defining a specific size for the window but the default one is good enough and also because some browsers (i.e. Brave) store the previous size giving more flexibility to the users.

@douglascamata
Copy link

Interestingly the Vivaldi picture-in-picture feature already appeara as a floating window that stay on top of others for me. I have no special configuration for this besides the classic settings of the ozone platform to wayland.

@kennethgeerts
Copy link
Contributor

If this gets merged, I think it would be a good idea to also add a rule for preserving the aspect ratio. Here's how I've got it set up for chromium:

windowrule = float, title:^(?i)picture in picture$
windowrule = noborder, title:^(?i)picture in picture$
windowrule = keepaspectratio, title:^(?i)picture in picture$
windowrule = pin, title:^(?i)picture in picture$
windowrule = noinitialfocus, title:^(?i)picture in picture$
windowrule = opacity 1.0 1.0, title:^(?i)picture in picture$

windowrule = noborder, title:^(Picture.{0,1}in.{0,1}[Pp]icture)$
windowrule = opacity 1.0 1.0, title:^(Picture.{0,1}in.{0,1}[Pp]icture)$

# Proper background blur for wofi
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't change anything here, not sure why GitHub shows it as new

@ElFitaFlores
Copy link
Author

If this gets merged, I think it would be a good idea to also add a rule for preserving the aspect ratio. Here's how I've got it set up for chromium:

windowrule = float, title:^(?i)picture in picture$
windowrule = noborder, title:^(?i)picture in picture$
windowrule = keepaspectratio, title:^(?i)picture in picture$
windowrule = pin, title:^(?i)picture in picture$
windowrule = noinitialfocus, title:^(?i)picture in picture$
windowrule = opacity 1.0 1.0, title:^(?i)picture in picture$

Thanks for the ideas @kennethgeerts, I updated the PR to include some of them. It definitely improved the quality of the implementation.

dhh added a commit that referenced this pull request Aug 4, 2025
@dhh
Copy link
Member

dhh commented Aug 4, 2025

Great work on this! I updated it a bit, put it in the new folder, and gave you commit credit. Thanks 👌

@dhh dhh closed this Aug 4, 2025
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

Successfully merging this pull request may close these issues.

4 participants