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

Window rules no longer work on context menus #2020

Closed
rm-rf-no-preserve-root opened this issue Nov 20, 2023 · 6 comments
Closed

Window rules no longer work on context menus #2020

rm-rf-no-preserve-root opened this issue Nov 20, 2023 · 6 comments
Labels
Milestone

Comments

@rm-rf-no-preserve-root
Copy link

Describe the bug

In 0.7.5 the window rule on created if focusable is false then set alpha 0.8 caused all context menus and tooltips to be transparent. When I updated to 0.8.0, without changing my config file, this stopped working.

Even the rule on created then set alpha 0.8, which should affect everything, doesn't make context menus transparent.

However, manually changing the opacity of context menus with the key binding works fine.

To Reproduce

Steps to reproduce the behavior:

  1. Enable plugin window-rules
  2. Add the rule on created if focusable is false then set alpha 0.8 or on created then set alpha 0.8
  3. Open a context menu or tooltip of you choice (in 0.7.5 it worked with all Wayland applications, such as PCManFM-Qt or wf-panel) and witness it being completely opaque

Wayfire version

AUR-package 0.8.0-3

@ammen99 ammen99 added this to the 0.8.1 milestone Nov 20, 2023
@ammen99
Copy link
Member

ammen99 commented Nov 20, 2023

The focusable part of this bug is likely the same problem which causes #2007 . There is a patch there waiting to be tested, maybe try it out if you can compile from source.

About the on created then set alpha 0.8 rule: it seems to work here, are you sure you haven't commented out the line, or that the rule didn't get overwritten (for example if you have ruleX = .. and then ruleX = ... again)?

@rm-rf-no-preserve-root
Copy link
Author

I made a fresh install of Wayfire with the patch and used the default config file, where i only changed the [window-rules] section:

[window-rules]
unfocusable_transparency = on created if focusable is false then set alpha 0.7

Unfortunately it has not fixed the issue with the context menus.

I also again tried to set everything to be transparent:

[window-rules]
global_transparency = on created then set alpha 0.7

which yielded the same result as before.
When you tested this, did you make sure it works with context menus? Because for me it works with regular windows, just not with context menus.

On a more positive note: The patch seems to have fixed the issue described in #2007. Menus in Xwayland applications open without the animation.

@soreau
Copy link
Member

soreau commented Nov 20, 2023

You also need alpha plugin enabled, though you say default config file so I expect it is enabled. However you can check the log with wayfire -d for plugins loaded to make sure there is no problem, to make sure there's no problems loading window-rules or alpha plugins by looking for messages such as Loaded plugin /prefix/lib/libdir/wayfire/alpha.so.

@ammen99
Copy link
Member

ammen99 commented Nov 20, 2023

Hmm, I dug a little bit deeper and I can see what the problem is. I erroneously assumed window-rules are used just for toplevel windows and basically removed support for window-rules of non-toplevel windows. I'll re-add support for the 0.8.1 release.

In the meantime, you could try the alternative to window rules which is ipc-scripts: enable the plugins ipc and ipc-rules, put the following script in the ipc-scripts/ subfolder (where Wayfire was cloned) or copy the ipc-scripts/wayfire_socket.py file to another location with the script, then start it (you can also do it from autostart):

#!/usr/bin/python3
import os
from wayfire_socket import *

addr = os.getenv('WAYFIRE_SOCKET')
sock = WayfireSocket(addr)
sock.watch()

while True:
    msg = sock.read_message()
    # The view-mapped event is emitted when a new window has been opened.
    if "event" in msg and msg["event"] == "view-mapped":
        view = msg["view"]
        if view["focusable"] == False:
            sock.set_view_alpha(view["id"], 0.8)

@rm-rf-no-preserve-root
Copy link
Author

That works. Thanks a ton!

@ammen99
Copy link
Member

ammen99 commented Nov 26, 2023

I was just going through the code to see how to re-introduce the functionality but then I saw that set alpha is actually the only supported operation for non-toplevel windows such as the context menus or tooltips you described. So in #2032 I have added only the set alpha command for such windows. The rest of the operations are supported only for toplevels, even if they happened to work before on non-toplevel windows.

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

No branches or pull requests

3 participants