Hyprland icon indicating copy to clipboard operation
Hyprland copied to clipboard

Firefox Extensions uninfluenced by `windowrules`

Open spikespaz opened this issue 3 years ago • 4 comments
trafficstars

Windows that are opened by Firefox extensions cannot be affected by windowrules.

I have an extension called Tree Style Tabs that opens a window (that should be a modal) to ask for confirmation to discard many tabs.

The output from hyprctl clients when the window in question is open looks like the following:

Window 2734070 -> Extension: (Tree Style Tab) - Close tabs? — Mozilla Firefox:
	at: 2888,14
	size: 938,1052
	workspace: 2 (2)
	floating: 0
	monitor: 1
	class: firefox
	title: Extension: (Tree Style Tab) - Close tabs? — Mozilla Firefox
	pid: 152850
	xwayland: 0

I try to match Extension in the title for all Firefox windows, so that any window opened by an extension will float by default.

windowrule=float,title:^(Extension)(.+)(Firefox)(.*)$

Then the size is set for a more specific pattern, matching if Close tabs is in the middle of the title.

windowrule=size 630 470,title:^(Extension)(.+)(Close tabs)(.+)(Firefox)(.*)$

Neither of these rules work, and neither do less-strict patterns that only look for title:Extension.

I have verified both of these regex patterns, and that windowrules works for other programs.

spikespaz avatar Aug 30 '22 03:08 spikespaz

watch -n 0.1 "cat /tmp/hypr/$(echo $HYPRLAND_INSTANCE_SIGNATURE)/hyprland.log | grep -v "efresh" | grep "rule" | tail -n 40"

will tail the logs for window rules. Whenever a window is open, it will log searching rules, e.g.:

[LOG] Searching for matching rules for org.kde.dolphin (title: Extracting Files (86%) — Dolphin)

Those are the arguments passed to the regex checks. If an app is written by an idiot, it may set its title after mapping, meaning it's basically unmatchable in the current windowrule state.

vaxerski avatar Aug 30 '22 08:08 vaxerski

That does appear to be the issue. This is the window that opens:

[LOG] Set keyboard focus to surface 1ea1300, with window name: Firefox Extensions uninfluenced by `windowrules`  Issue #602  hyprwm/Hyprland  Mozilla Firefox

This is what it changes to:

Window 1ee3140 -> Extension: (Tree Style Tab) - Close tabs? — Mozilla Firefox:
	at: 968,14
	size: 938,1052
	workspace: 2 (2)
	floating: 0
	monitor: 1
	class: firefox
	title: Extension: (Tree Style Tab) - Close tabs? — Mozilla Firefox
	pid: 119264
	xwayland: 0

spikespaz avatar Sep 02 '22 11:09 spikespaz

Any hope for a remedy? Is it possible to get a signal from somewhere every time a window changes its title?

spikespaz avatar Sep 02 '22 11:09 spikespaz

it's planned.

vaxerski avatar Sep 02 '22 13:09 vaxerski

Since dynamic window rules have been impl'd a while back, I am closing this.

float rules cannot be dynamic though, as it would require an active layout change after the window has already been created.

vaxerski avatar Dec 21 '22 15:12 vaxerski

Hello, is there any solution to this? I have an extension which has a popup that goes fullscreen and I have no way to make floating and/or smaller. The nofullscreenrequest and nomaximizerequest aren't affecting these popup. Even setting maxsize/minsize/size doesn't affect the window (and I have checked that the rule matches in the log).

babariviere avatar Sep 22 '23 17:09 babariviere

I'm having the same problem with Bitwarden popups in Firefox. The following works, but it affects all Firefox windows:

windowrulev2=float,class:^firefox$
windowrulev2=nofullscreenrequest,class:^firefox$

But the following doesn't:

windowrulev2=float,class:^firefox$,title:^Extension:
windowrulev2=nofullscreenrequest,class:^firefox$,title:^Extension:

musjj avatar Feb 22 '24 06:02 musjj

@musjj missing .*$

spikespaz avatar Feb 24 '24 18:02 spikespaz

@spikespaz Doesn't work either, unfortunately.

musjj avatar Feb 24 '24 18:02 musjj

That works for me: windowrulev2=nomaximizerequest, class:.* In my case, I was getting annoying notifications on half screen from "Simple Tab Groups" extension (btw, great extension for managing sessions)

nikita-talalai avatar Mar 10 '24 21:03 nikita-talalai