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

X.Operations: Apply size hints in floatLocation #446

Merged
merged 1 commit into from
May 20, 2023

Conversation

liskin
Copy link
Member

@liskin liskin commented Apr 2, 2023

Description

This is hopefully harmless with well-behaved clients and ordinary xmonad configs, and it enables using re-floating to apply size hints to existing windows. The only visible behaviour change I can foresee is that tiled windows (which ignore hints by default, unless X.L.LayoutHints is used) will now snap to size hints whenever they're floated (either via a keybinding or on mouseMoveWindow), whereas previously they'd only do so on mouseResizeWindow.

My use-case for this is the following: when I change fonts in my terminal, it updates its size hints and then sends a ConfigureRequestEvent to change its size to keep the number of rows and columns the same, and it also happens to reset the position to 0, 0. If it's tiled, that request is just ignored and hintsEventHook handles the layout refresh. If it happens to be floating, I want neither the move to 0, 0 nor the window size change to keep rows/colums, so I have a handleEventHook that ignores that ConfigureRequestEvent and just refloats the window, but I need a way to reapply size hints.

I could add a separate function that applies these hints to the floating RationalRect, but that seems like a lossy operation due to the Doubles in there. So I'd probably end up replicating most of the code from floatLocation, and then I might just improve that instead… 🙂

(I'll submit that custom ConfigureRequestEvent-ignoring hook to xmonad-contrib later.)

Checklist

  • I've read CONTRIBUTING.md

  • I've confirmed these changes don't belong in xmonad-contrib instead:
    see the 3rd paragraph 🙂

  • I've considered how to best test these changes (property, unit, manually, ...) and concluded:
    Making sure this doesn't break anything involves using it with all sorts of X clients. I've been running this for about a week with no trouble, but I haven't run any Steam games or Libreoffices during this time, so it definitely needs more testing.

  • I updated the CHANGES.md file - TODO I don't know what to say, yet.

Copy link
Member

@slotThe slotThe left a comment

Choose a reason for hiding this comment

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

FWIW I've been trying this out for the past few days, and I did not notice any change in behaviour at all (and we did find out that you and I have very different workflows!)

Then again, I almost aggressively avoid floats, so there's that :)

This is hopefully harmless with well-behaved clients and ordinary xmonad
configs, and it enables using re-floating to apply size hints to
existing windows. The only visible behaviour change I can foresee is
that tiled windows (which ignore hints by default, unless
X.L.LayoutHints is used) will now snap to size hints whenever they're
floated (either via a keybinding or on mouseMoveWindow), whereas
previously they'd only do so on mouseResizeWindow.

My use-case for this is the following: when I change fonts in my
terminal, it updates its size hints and then sends a
ConfigureRequestEvent to change its size to keep the number of rows and
columns the same, and it also happens to reset the position to 0, 0. If
it's tiled, that request is just ignored and hintsEventHook handles the
layout refresh. If it happens to be floating, I want neither the move to
0, 0 nor the window size change to keep rows/colums, so I have a
handleEventHook that ignores that ConfigureRequestEvent and just
refloats the window, but I need a way to reapply size hints.

I could add a separate function that applies these hints to the floating
RationalRect, but that seems like a lossy operation due to the Doubles
in there. So I'd probably end up replicating most of the code from
floatLocation, and then I might just improve that instead… :-)

(I'll submit that custom ConfigureRequestEvent-ignoring hook to
xmonad-contrib later.)
@liskin liskin merged commit 00045cf into xmonad:master May 20, 2023
14 checks passed
@liskin liskin deleted the floatloc-size-hints branch May 20, 2023 06:43
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.

None yet

2 participants