GithubHelp home page GithubHelp logo

Comments (20)

johanmalm avatar johanmalm commented on September 25, 2024

I've just tried MoveTo with xterm and it works fine here.

from labwc.

bdantas avatar bdantas commented on September 25, 2024

Maybe my syntax is wrong? I'm trying to move Thunderbird (AppImage of an old gtk2 version) using this rule in ~/.config/labwc/rc.xml, just as an example:

<windowRules>
	<windowRule identifier="" title="Thunderbird"><action name="MoveTo" x="10" y="10" /></windowRule>
</windowRules>

Definitely not working for me. The window opens in the center of my laptop's screen. What gives?

P.S. I'll try with xterm to remove any confounding factors.

from labwc.

bdantas avatar bdantas commented on September 25, 2024

The syntax is correct and it works with xterm.

Hmm, with Thunderbird (gtk2-based, xwayland app) and with Xfe (fox-based, xwayland app) ResizeTo and MoveTo do not work at all. Any ideas?

from labwc.

johanmalm avatar johanmalm commented on September 25, 2024

Are you sure the identifier / title is correct. Might not work with identifier=""
Run labwc -d to see the identifier + title when you launch (map) an application.

from labwc.

Consolatis avatar Consolatis commented on September 25, 2024

Just a guess, maybe the title is not correct during startup and thus the Thunderbird rule doesn't match.
You could try to use the identifier rather than the title, see wlrctl window list.

from labwc.

bdantas avatar bdantas commented on September 25, 2024

Thank you both.

$ wlrctl window list
foot: foot
Thunderbird: Inbox - Mozilla Thunderbird
	<windowRule identifier="Thunderbird"><action name="ResizeTo" width="900" height="550" /><action name="MoveTo" x="10" y="10" /></windowRule>

Now it works!

I assumed the output of wlrctl window list were titles. What's the difference between "identifier" and "title" in this context?

from labwc.

Consolatis avatar Consolatis commented on September 25, 2024

I assumed the output of wlrctl window list were titles. What's the difference between "identifier" and "title" in this context?

The title may change randomly, for example in thunderbird it looks like you'd get a new title when you change the folder.
The identifier (or app_id / WM_CLASS) is usually the same during the runtime of the application.

Edit:
Just to clarify, you could likely still use the title with something like title="*Thunderbird*" but I'd always recommend to only use the identifier unless there are reasons not to (for example when you only want to match a specific window of a multi window application).

from labwc.

johanmalm avatar johanmalm commented on September 25, 2024

I assumed the output of wlrctl window list were titles. What's the difference between "identifier" and "title" in this context?

Depends on the client. If you run labwc nested (from the terminal) you can see what they are.

from labwc.

bdantas avatar bdantas commented on September 25, 2024

Thank you both very much--not only for helping me solve my issue, but also for sharing your knowledge. Many thanks! Happy hacking!

from labwc.

bdantas avatar bdantas commented on September 25, 2024

Darn, I found another unexpected behavior related to this.

Here is the rule:

	<windowRule identifier="" title="Write:*"><action name="ResizeTo" width="800" height="400" /><action name="MoveTo" x="300" y="200" /></windowRule>

Here is relevant output from wlrctl:

$ wlrctl window list
foot: foot
Thunderbird: Write: (no subject)
Thunderbird: Inbox - Mozilla Thunderbird
brave-browser: ResizeTo and MoveTo actions not working for xwayland windows · Issue #1446 · labwc/labwc - Brave

Rule works when I compose first email in Thunderbird. When I go to compose second and subsequent emails, the window with "Write:*" in the title is the correct size but opens at location 0,0 (at top-left corner, with titlebar and minimize/maximize/close buttons off the screen). I tried using "identifier" instead of "title" in the rule, but it didn't help. Any ideas what's going on here?

from labwc.

johanmalm avatar johanmalm commented on September 25, 2024

matchOnce?

https://labwc.github.io/labwc-config.5.html#entry_matchonce

from labwc.

Consolatis avatar Consolatis commented on September 25, 2024

Not sure why this is happening. In general I'd suggest using SnapToRegion rather than the ResizeTo and MoveTo combination.

from labwc.

bdantas avatar bdantas commented on September 25, 2024

Thanks for the tip, but no luck. I tried rule with matchOnce="false" as well as with matchOnce="true", both times got the same unexpected behavior (MoveTo action working only on first email that I write).

I'll give SnapToRegion a try.

from labwc.

bdantas avatar bdantas commented on September 25, 2024

SnapToRegion works reliably, but only if I don't move the window. If I do move it, subsequent "Write" windows open at 0,0.

I have a theory: I think this is Tbird interfering by trying to "help" the user by remembering where the Write window is moved to. Whatever algorithm Tbird is using for window location doesn't work in Xwayland, so window ends up at 0,0 when Tbird tries to move the window to the place it was last moved to.

For whatever reason, SnapToRegion is able to put the window where user wants it to be, without Tbird being able to detect that the window was moved.

from labwc.

bdantas avatar bdantas commented on September 25, 2024

I experimented a lot more and can confirm that Thunderbird is interfering by trying to move windows to where they were last moved to, but is doing so using incorrect coordinates. There does not seem to be any Thunderbird setting that disables this annoying behavior, despite many settings with promising names in the advanced configuration editor (about:config).

Is there any window rule that makes labwc take full control of window placement, forbidding applications from interfering? If not, maybe there a way to introduce a slight delay before a windowRule action (so that labwc moves/resizes the window after the application has done so)?

from labwc.

ahesford avatar ahesford commented on September 25, 2024

Seems to me the best solution would be kicking Thunderbird to the curb. 🤣

I recently discovered a use case for a Delay actions which could hack around some misbehaviors. Not sure about the others, but I could be persuaded that such an action has value.

from labwc.

bdantas avatar bdantas commented on September 25, 2024

Seems to me the best solution would be kicking Thunderbird to the curb. 🤣

I've considered that. All GUI email clients are terrible, but so far I've found Thunderbird to be the least terrible.

Regarding a Delay action, I'd really love it. I don't want to fight with buggy applications or swap them out. I'd rather just trample on their misbehavior with window rules.

from labwc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.