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

Feature request: add "Center" action #1511

Closed
stefonarch opened this issue Feb 7, 2024 · 8 comments
Closed

Feature request: add "Center" action #1511

stefonarch opened this issue Feb 7, 2024 · 8 comments

Comments

@stefonarch
Copy link
Contributor

There is already

       <action name="AutoPlace" />
           Use  the  automatic  placement policy to move the active window to a position on its output that
           will minimize overlap with other windows.

I'm using "cursor" as default placement method and it would be nice to have a window rule or shortcut to center windows.

@RiccardoPP
Copy link

I don't know if this is your case, but you could define a "center" region and snap windows to it.

This is mine:

    <region name="center" x="5%" y="5%" height="90%" width="90%"/>

than:

    <keybind key="W-S-c">
      <action name="SnapToRegion" region="center"/>
    </keybind>

@stefonarch
Copy link
Contributor Author

Thanks, I'm aware of this but it changes window sizes, I'd like to have all qarma windows centered for example.

@Consolatis
Copy link
Member

Consolatis commented Feb 7, 2024

I guess we could

  • add an optional argument to the action
  • or make the action depend on the default placement method

Or potentially both, something like <action name="AutoPlace" policy="value" /> with value being one of center | automatic | cursor | inherit. Alternative: always use the configured placement policy for this action by default and only use something else when configured with the policy argument. Then we wouldn't need the inherit one.

@ahesford thoughts about that?

@stefonarch
Copy link
Contributor Author

I forgot to mention that we have already <action name="MoveToCursor" />.

@ahesford
Copy link
Member

ahesford commented Feb 7, 2024

I called it "AutoPlace" and forced the "automatic" placement policy originally because "MoveToCursor" already exists, and I didn't think at the time that re-centering windows would be a particularly interesting action. Respecting a policy argument and defaulting to rc.placement_policy when none is specified would be a good way to generalize this feature and make it even more useful in combination with rule-based resize actions. A refactor of view_place_initial toward this end would have the added benefit of removing some redundancy currently in action handling.

@tsujan
Copy link

tsujan commented Feb 7, 2024

Or a window rule like skipPlacement might be added for following the default placement, i.e., center. Although I did that for myself, it might be a little confusing to users.

BTW, automatic placement is a very nice feature. It's just that the user may like to put some windows at the center, like they were under X11 — for example, all parentless Qt dialogs are positioned at the center under X11 (dialogs with parents are centered with respect to their parents).

@stefonarch
Copy link
Contributor Author

With latest Qt6 and layershell this could be quite important now, to be able to set some configuration windows at center screen, as on left and bottom panel they are aligned to screenborder.

@stefonarch
Copy link
Contributor Author

Done in #1785

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

No branches or pull requests

5 participants